PHP code example of vis / esputnik_client_l5

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

    

vis / esputnik_client_l5 example snippets


   Vis\eSputnikClient\eSputnikClientServiceProvider::class,

    php artisan vendor:publish --tag=esputnik-client-config --force

    use Vis\eSputnikClient\eSputnikClient;

    $client = new eSputnikClient();

    $result  = $client->getVersion();

    $letterTemplate = 'email_send';
    $recipient = ['[email protected]'];
    $params    = ['name' => 'k.glushchenko', 'message' => 'test_letter'];

    $result  = $client->sendPreparedMessage($letterTemplate, $recipient, $params);

    $letterTemplate = 'sms_send';
    $recipient = ['+38(000)-000-00-00'];
    $params    = ['name' => 'k.glushchenko', 'message' => 'test_letter'];

    $result  = $client->sendPreparedMessage($letterTemplate, $recipient, $params, false);


    $letterTemplate = 'email_smartsend';
    $recipient = ['[email protected]', '[email protected]'];
    $params    = [
        ['name' => 'name_for_email1', 'message' => 'message_for_email1'],
        ['name' => 'name_for_email2', 'message' => 'message_for_email2']
    ];

    $result  = $client->sendExtendedPreparedMessage($letterTemplate, $recipient, $params);


    $letterTemplate = 'sms_smartsend';
    $recipient = ['+38(000)-000-000-00', '+38(000)-000-00-01'];
    $params    = [
        ['name' => 'name_for_00', 'message' => 'message_for_00'],
        ['name' => 'name_for_01', 'message' => 'message_for_01']
    ];

    $result  = $client->sendExtendedPreparedMessage($letterTemplate, $recipient, $params, false);

    $result = $client->getInstantMessageStatus($id);

    $from       = '"organization" <[email protected]>';
    $subject    = 'subject';
    $htmlText   = '<html><body><h1>test!</h1></body></html>';
    $emails     = ['[email protected]'];

    $result  = $client->sendEmail($from, $subject, $htmlText,$emails);

    $result = $client->getInstantEmailStatus($hash);

     $from   = 'your_sms_sender';
     $text   = 'test';
     $phones = ["+38(000)-000-00-00"];

     $result  = $client->sendSMS($from, $text, $phones);

    $result = $client->getInstantSmsStatus($hash);