Giter VIP home page Giter VIP logo

resala's Introduction

PHP & Laravel SMS Gateway Integration Package

Latest Version on Packagist Build Status Quality Score Total Downloads

Resala is a PHP & Laravel Package, (Designed to add support to your laravel or just native php app for sending SMS using local operators in the MENA region Like Vodafone, Infopib, Conneckio).
Resala not just tied to use inside Laravel you can hook it up in any php code

Supported Providers

  • Vodafone SMS Gateway
  • Connekio SMS Gateway
  • InfoPib SMS Gateway

Installation

You can install the package via composer:

composer require robust-tools/resala

Laravel Usage.

Configure

publish the config file with:

php artisan vendor:publish --provider="RobustTools\SMS\SMSServiceProvider" --tag="config"

This is the contents of the published config file:

return [

    /*
     * You can specify a default service provider driver here.
     * If it is not set we'll use vodafone as the default driver.
     */
    'default' => env('SMS_DRIVER', 'vodafone'),

    /*
    |--------------------------------------------------------------------------
    | List of sms drivers
    |--------------------------------------------------------------------------
    |
    | This is a list of possible sms gateways drivers
    |
    */

    'drivers' => [

        'vodafone' => [
            'end_point' => env('VODAFONE_END_POINT'),
            'account_id' => env('VODAFONE_ACCOUNT_ID'),
            'password' => env('VODAFONE_PASSWORD'),
            'secure_hash' => env('VODAFONE_SECURE_HASH'),
            'sender_name' => env('VODAFONE_SENDER_NAME', 'Vodafone')
        ],

        'connekio' => [
            'single_sms_endpoint' => env('SINGLE_SMS_ENDPOINT'),
            'batch_sms_endpoint' => env('BATCH_SMS_ENDPOINT'),
            'username' => env('CONNEKIO_USERNAME'),
            'password' => env('CONNEKIO_PASSWORD'),
            'account_id' => env('CONNEKIO_ACCOUNT_ID'),
            'sender_name' => env('CONNEKIO_SENDER_NAME')
        ],

        'infobip' => [
            'end_point' => env('INFOBIP_END_POINT'),
            'username' => env('INFOBIP_USERNAME'),
            'password' => env('INFOBIP_PASSWORD'),
            'sender_name' => env('INFOBIP_SENDER_NAME', 'Infobip')
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Class Maps
    |--------------------------------------------------------------------------
    |
    |
    | This is a list of Classes that maps to the Drivers above.
    */
    'map' => [
        'vodafone' => VodafoneDriver::class,
        'connekio' => ConnekioDriver::class,
        'infobip' => InfobipDriver::class
    ],
];
php artisan resala:make vodafone

This adds vodafone environment variables to your .env file.

php artisan resala:make connekio

This adds connekio environment variables to your .env file.

php artisan resala:make infobip

This adds infobip environment variables to your .env file.

Usage

SMS::to('010xxxxxxxx')
    ->message("Hello World")
    ->send();

SMS::to(['010xxxxxxxx', '011xxxxxxxx'])
    ->message("Hello World")
    ->send();

you can optionally change the driver using the via method

SMS::via('connekio')
    ->to('010xxxxxxxx')
    ->message("Hello World")
    ->send();

SMS::via('infobip')
    ->to('2012xxxxxxxx')
    ->message("Hello World")
    ->send();

#Outside Laravel You need to add a config file named resala.php in your project directory the contents of the config file must match the schema of the package config file you can find it HERE. just replace the env(values) with your driver config values.

##Usage

use RobustTools\SMS\SMSManager;

$configFile = __DIR__ . "/config/resala.php";

(new SMSManager($configFile))->to(['010995162378', '012345522'])
         ->message("Hello World")
         ->send();

IF no configuration file is being passed a ConfigFileNotFoundException will be thrown.

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

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

resala's People

Contributors

mohabdelaziz95 avatar khaledhesham avatar olfatmostafa avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.