PHP code example of zerosdev / kirimwa-php-client

1. Go to this page and download the library: Download zerosdev/kirimwa-php-client 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/ */

    

zerosdev / kirimwa-php-client example snippets




namespace App\Http\Controllers;

use KirimWA;

class YourController extends Controller
{
    public function index()
    {
        KirimWA::sendText('6281234567890', 'This is message to be sent');

        if( KirimWA::hasError() ) {
            dd(KirimWA::error());
        }
        else {
            dd(KirimWA::response());
        }
    }
}



erosDev\KirimWA\Client;
use ZerosDev\KirimWA\Config;

Config::apply([
    'default_host'  => 'http://yourwaserver.com',
    'senders'       => [
        '6281234567890' => [
            'host'  => ':3001', // just place port number to follow 'default_host'
            'key'   => 'your api key here'
        ],
        '6280987654321' => [
            'host'  => 'http://youranotherwaserver.com:3002', // or place full API host with port to use different host than the 'default_host'
            'key'   => 'your api key here'
        ],
    ]
]);

$kirimwa = new Client();
$kirimwa->sendText('6281234567890', 'This is message to be sent');

if( $kirimwa->hasError() ) {
    echo $kirimwa->error();
}
else {
    echo $kirimwa->response();
}