Skip to content

Laravel Unifonic - A library to integrate with Unifonic API. Sending SMS, making Voice and VOIP calls, TTS calls, and 2FA

License

Notifications You must be signed in to change notification settings

safcsp/laravel-unifonic

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Unifonic 5.x

Start sending SMS and making Voice calls with Unifonic right away using Laravel.

Total Downloads Latest Stable Version License


Installation

First, install the package through Composer.

$ composer require liliom/laravel-unifonic

Laravel 5.5 and up

You don't have to do anything else, this package uses the Package Auto-Discovery feature, and should be available as soon as you install it via Composer.

Laravel 5.4 and down

Then include the service provider inside config/app.php.

'providers' => [
    ...
    Liliom\Unifonic\UnifonicServiceProvider::class,
    ...
];

And add the alias as well

'aliases' => [
    ...
    'Unifonic' => Liliom\Unifonic\UnifonicFacade::class,
    ...
],

Configurations

Hit to Dashboard to create a new REST app to use this channel. Within in this app, you will find the APP ID. Place it inside your .env file. To load it, add this to your config/services.php file:

'unifonic' => [
    'app_id' => env('UNIFONIC_APP_ID'),
    'sender_id' => env('UNIFONIC_SENDER_ID') //optional
]

If you don't want to publish the configs add Unifonic App Id within your .env file

UNIFONIC_APP_ID={YOUR_DEFAULT_APP_ID}

Usage

Account related methods:

Unifonic::getBalance();
Unifonic::addSenderID(string $senderID);

// To test credentials and make sure the APP ID is configured correctly. 
Unifonic::testCredentials();

Messages related methods:

Unifonic::send(int $recipient, string $message, string $senderID = null);
Unifonic::sendBulk(array $recipients, string $message, string $senderID = null);
Unifonic::getMessageIDStatus(int $messageID);
Unifonic::getMessagesReport($dateFrom = null, $dateTo = null, string $senderId = null, string $status = null, string $delivery = null);

You may make asynchronous calls to Unifonic API, by prefixing your methods with the async() function:

Unifonic::async(true) // async calls on, default value is true
Unifonic::async(false) // async calls off

// Later you can append the callback() to be executed when the response returns.
Unifonic::async()->callback(Callable $requestCallback) 

For more details about the parameters please refer to the Api Documentation for more info, or read the source code.

Contributing

See the CONTRIBUTING guide.

Changelog

Please see CHANGELOG for more information about what has changed recently.

About

Laravel Unifonic - A library to integrate with Unifonic API. Sending SMS, making Voice and VOIP calls, TTS calls, and 2FA

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%