PHP code example of clzola / laravel-sms

1. Go to this page and download the library: Download clzola/laravel-sms library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

clzola / laravel-sms example snippets


SMS::to($user)
   ->content("Hi! Your order has been shipped!")
   ->send();

return [

    /*
     * Specify which database driver you want to use.
     */
    'default' => env('SMS_DRIVER', 'null'),


    /*
     * Specify sender name.
     */
    'from' => env('SMS_FROM', 'Laravel'),


    /*
     * List of drivers and theirs configurations.
     */
    'drivers' => [

        /*
         * Driver for sending sms messages to running emulator.
         */
        'emulator' => [

            /*
             * Specify Android SDK path
             */
            'android_sdk_path' => env('SMS_ANDROID_SDK_PATH'),

        ]

    ]
    
];

SMS::to($user)->content($message)->send();

use clzola\Components\Sms\Contracts\HasPhoneNumber;

class Company extends Model implements HasPhoneNumber 
{
    // ...
    
    public function getPhoneNumber()
    {
        return $this->phone_number;
    }  
}

// ...

$company = Company::find(3);
SMS::to($company)->content($message)->send();

use clzola\Components\Sms\Drivers\Driver;

class CustomSmsDriver extends Driver 
{
    
    // ...
    
    public function send()
    {
        // Write code to send SMS message
    }
}

class AppServiceProvider extends ServiceProvider
{
    // ...

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        app("sms")->registerDriver("custom", new CustomSmsDriver(...));
    }
}