Start sending SMS and making Voice calls with Unifonic right away using Laravel.
First, install the package through Composer.
$ composer require liliom/laravel-unifonic
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.
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,
...
],
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}
Unifonic::getBalance();
Unifonic::addSenderID(string $senderID);
// To test credentials and make sure the APP ID is configured correctly.
Unifonic::testCredentials();
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.
See the CONTRIBUTING guide.
Please see CHANGELOG for more information about what has changed recently.