PHP code example of coreproc / chikka-api-sdk

1. Go to this page and download the library: Download coreproc/chikka-api-sdk 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/ */

    

coreproc / chikka-api-sdk example snippets




oreproc\Chikka\ChikkaClient;
use Coreproc\Chikka\Models\Sms;
use Coreproc\Chikka\Transporters\SmsTransporter;

$chikkaClient = new ChikkaClient('your-chikka-client-id', 'your-chikka-secret-key', 'your-chikka-shortcode');

$sms = new Sms('unique-message-id', 'mobile-number', 'your-message-here');

$smsTransporter = new SmsTransporter($chikkaClient, $sms);

$response = $smsTransporter->send();

print_r($response);



namespace Vendor\PackageName;

use Coreproc\Chikka\Contracts\SmsContract;
use Coreproc\Chikka\Contracts\SmsTransporterActionsContract;
use Exception;

class SampleSmsTransporterActions implements SmsTransporterActionsContract
{

    public function __construct(ChikkaClient $chikkaClient, SmsContract $sms)
    {
        // TODO: Implement __construct() method.
    }

    public function onStart()
    {
        // TODO: Implement onStart() method.
    }

    public function onInvalid(Exception $exception)
    {
        // TODO: Implement onInvalid() method.
    }

    public function onError(Exception $exception)
    {
        // TODO: Implement onError() method.
    }

    public function onSuccess()
    {
        // TODO: Implement onSuccess() method.
    }
}

$chikkaClient = new ChikkaClient('your-chikka-client-id', 'your-chikka-secret-key', 'your-chikka-shortcode');

$sms = new Sms('unique-message-id', 'mobile-number', 'your-message-here');

$smsTransporter = new SmsTransporter($chikkaClient, $sms);

$sampleSmsTransporterActions = new SampleSmsTransporterActions($chikkaClient, $sms);

$response = $smsTransporter->send($sampleSmsTransporterActions);