PHP code example of valinteca-test / localization

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

    

valinteca-test / localization example snippets


use Valinteca\Localization\Facades\Localization;

Localization::to('05xxxxxxxx')
    ->message('hello world')
    ->send();

Localization::sender('another sender')
    ->to('05xxxxxxxx')
    ->message('hello world')
    ->send();

Localization::to(['05xxxxxxxx', '05xxxxxxxx'])
    ->message('hello world')
    ->send();

// Using string datetime format
Localization::to('05xxxxxxxx', '05xxxxxxxx')
    ->message('hello world')
    ->at('2023-05-01 20:10:05')
    ->send();

// Using carbon instance
Localization::to('05xxxxxxxx', '05xxxxxxxx')
    ->message('hello world')
    ->at(now()->addMinutes(5))
    ->send();

Localization::to('05xxxxxxxx')
    ->options([
        'reqBulkId' => true,
        'msgEncoding' => 'windows-1256',
        'reqFilter' => false,
    ])
    ->message('hello world')
    ->send();

Localization::to(['05xxxxxxxx', '05yyyyyyyy'])
    ->message('Hello {name}. Your order {order} will be delivered soon')
    ->sendPersonalized([
        ['name' => 'Mohammed', 'order' => '123'],
        ['name' => 'Ahmed', 'order' => '456'],
    ]);

    // Messages:
    // 05xxxxxxxx: "Hello Mohammed. Your order 123 will be delivered soon" 
    // 05yyyyyyyy: "Hello Ahmed. Your order 456 will be delivered soon"

Localization::to('05xxxxxxxx')
    ->sendTestMessage();

Localization::getBalance();

Localization::forBulkId('bulk-id-returned-from-send-method')
    ->getMessages();

Localization::forBulkId('bulk-id-returned-from-send-method')
    ->page(2)
    ->getMessages();

Localization::forBulkId('bulk-id-returned-from-send-method')
    ->page(1)
    ->limit(5)
    ->getMessages();

Localization::to(['05xxxxxxxx', '05yyyyyyyy'])
    ->message('this is message')
    ->calculateCost();

Localization::getBalance();

php artisan vendor:publish --provider="Valinteca\Localization\LocalizationServiceProvider"