PHP code example of kickstartph / semaphore-client

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

    

kickstartph / semaphore-client example snippets



    Semaphore\SemaphoreClient;
    $client = new SemaphoreClient( '{YOUR_API_KEY}', '{OPTIONAL_SENDER_NAME}' ); //Sender Name defaults to SEMAPHORE
    echo $client->send( '09991234567', 'Your message' );

    echo $client->send( '09991234567', 'Your message', '{NEW_SENDER_ID}' );

    echo $client->send( '09991234567,09997654321,', 'Your message' );
 
    //Will return the results for page 2 of sent messages
    echo $client->messages( [ 'limit'=> 100 , 'page' => 2 ] ); 
 
    //Use any date format str_to_time() supports
    echo $client->messages( 'startDate' => '2016-10-01, '2016-10-31' );  
 
    //Returns all messages sent to recipients on the Globe network
    echo $client->messages( ['globe'] ); 

   $options = [
        'limit' => 100,
        'page' => 1,
        'sendername' => 'SEMAPHORE',
        'startDate' => '2016-01-01',
        'endDate' => '2016-02-01',
        'network' => 'globe',
        'status' => 'success'
   ];

    echo $client->account();

    echo $account->users();

    echo $account->sendernames();

    echo $account->transactions();
json
[
  {
    "name":"Semaphore",
    "status":"Active",
    "created":"2016-01-01 00:00:01"
  },
  {
    "name":"Kickstart",
    "status":"Active",
    "created":"2016-01-01 00:00:01""
  }
]