simple laravel package to sending sms , supports multiple drivers

v1.0.8 2021-02-17 07:35 UTC

README

Laravel Sending SMS

Latest Stable Version Total Downloads Latest Unstable Version License StyleCI Code Quality Score

This is a Laravel Package for Sending sms. This package supports Laravel 5.8+.

This packages works with multiple drivers, and you can create custom drivers if you can't find them in the current drivers list (below list).

List of contents

List of available drivers

Install

Via Composer

$ composer require alishojaeiir/smschi

Configure

If you are using Laravel 5.5 or higher then you don't need to add the provider and alias. (Skip to b)

a. In your config/app.php file add these two lines.

// In your providers array.
'providers' => [
...
/*
 * Package Service Providers...
 */
 
Alishojaeiir\Smschi\SmschiServiceProvider::class,
/*
 * Application Service Providers...
 */
...
],

// In your aliases array.
'aliases' => [
...
'smschi' => Alishojaeiir\Smschi\SmschiFacade::class,
],

b. then run php artisan vendor:publish to publish config/smschi.php file in your config directory.

In the config file you can set the default driver to use for all sending. But you can also change the driver at runtime.

Choose what provider you would like to use in your application. Then make that as default driver so that you don't have to specify that everywhere. But, you can also use multiple providers in a project.

// Eg. if you want to use parsasms.
'default' => 'parsasms',

Then fill the credentials for that gateway in the drivers array.

'drivers' => [
        'parsasms' => [
            'apiUrl' => "http://api.smsapp.ir/v2/sms/",
            'apiKey' => "api_key",
            'sender' => "sender number",
        ],
...
]

How to use

In your code, use it like the below:

\smschi::prepare($receiver, $message)->send();

Security

If you discover any security related issues, please email alishojaei34@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.