New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

multicaret/laravel-unifonic

A library to integrate with Unifonic API to send SMS
204,004 25
Install
composer require multicaret/laravel-unifonic
Latest Version:v2.1.0
PHP:>=7.1.0
License:MIT
Last Updated:Nov 8, 2023
Links: GitHub  ·  Packagist
Maintainer: mkwsra

Laravel Unifonic 8.x +

Start sending SMS with Unifonic right away using Laravel.

Total Downloads Latest Stable Version License


Installation

First, install the package through Composer.

$ composer require multicaret/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 below

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

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

And add the alias as well

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

Configurations

Head to Dashboard to create a new Application (check image below if you wish). Within in this app, you will find the APP SID copy it please. Now add these to your config/services.php file:

'unifonic' => [
    'app_id' => env('UNIFONIC_APP_ID'),
    'sender_id' => env('UNIFONIC_SENDER_ID'), // String, Optional
    'account_email' => env('UNIFONIC_ACCOUNT_EMAIL'),
    'account_password' => env('UNIFONIC_ACCOUNT_PASSWORD')
],

Now Place these in your .env file.

UNIFONIC_APP_ID=
UNIFONIC_SENDER_ID=
UNIFONIC_ACCOUNT_EMAIL=
UNIFONIC_ACCOUNT_PASSWORD=

Usage

// To test credentials and make sure the APP SID, email & password are set correctly. 
Unifonic::retrieveCredentialsForTesting();
Unifonic::send(int $recipient, string $message, string $senderID = null);
Unifonic::getMessageIDStatus(int $messageID);

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.

Related Packages

zizou86/laravel-unifonic

Package to use Unifonic API

17,691 5
sineld/sms

Türkiye Sms API for sending sms text messages.

27 9
itsaafrin/isms

A Laravel 4 SMS Api Package (isms.com.my)

5 4
messagebird/sdk

The official PHP SDK for the Bird API: email, SMS, WhatsApp, verification, and R...

1,903 0
kavenegar/laravel

laravel 4 and 5 kavenegar integration

382,470 86

Version History

Version Released PHP License
v2.1.0 >=7.1.0 MIT
v2.0.0 >=7.1.0 MIT
v1.0.2 >=7.1.0 MIT
v1.0.1 >=7.1.0 MIT
v1.0.0 >=7.1.0 MIT