PHP code example of mnovik / laravel-zadarma

1. Go to this page and download the library: Download mnovik/laravel-zadarma 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/ */

    

mnovik / laravel-zadarma example snippets


return [
    //other stuff
    'providers' => [
        //other stuff
        \Jlorente\Laravel\Zadarma\ZadarmaServiceProvider::class,
    ];
];

return [
    //other stuff
    'aliases' => [
        //other stuff
        'Zadarma' => \Jlorente\Laravel\Zadarma\Facades\Zadarma::class,
    ];
];

return [
    'api_key' => 'YOUR_API_KEY',
    'api_secret' => 'YOUR_API_SECRET',
    //other configuration
];

Zadarma::api()->getBalance();

/**
 * Get the SMS message.
 *
 * @param  mixed  $notifiable
 * @return string
 */
public function toZadarmaSms($notifiable)
{
    return 'Hello, this is an SMS sent through Zadarma API';
}

/**
 * Get the notification channels.
 *
 * @param  mixed  $notifiable
 * @return array|string
 */
public function via($notifiable)
{
    return [ZadarmaSmsChannel::class];
}

/**
 * Gets a phone/SIP number, a PBX extension number or a PBX scenario to which the 
 * phone callback will be made.
 *
 * @param mixed $notifiable
 * @return string
 */
public function toZadarmaPhoneCall($notifiable)
{
    return 100;
}

/**
 * Get the notification channels.
 *
 * @param mixed $notifiable
 * @return array|string
 */
public function via($notifiable)
{
    return [ZadarmaPhoneCallChannel::class];
}



namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable;

    /**
     * Route notifications for the Zadarma channels.
     *
     * @param  \Illuminate\Notifications\Notification  $notification
     * @return string
     */
    public function routeNotificationForZadarma($notification)
    {
        return $this->phone;
    }
}
bash
$ php composer.phar 
bash
$ php artisan vendor:publish --provider='Jlorente\Laravel\Zadarma\ZadarmaServiceProvider'