PHP code example of enigma972 / orange-api-client

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

    

enigma972 / orange-api-client example snippets



OrangeApiClient\Service\Sms\Sms;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use OrangeApiClient\Client;
use OrangeApiClient\Service\Sms\Message;

$cache = new FilesystemAdapter();
$client = new Client($cache, 'YOUR-CLIENT-ID', 'YOUR-CLIENT-SECRET');

$sms = new Sms($client);

$message = new Message();
$message
    ->content('Hello world, via Orange SMS API.')
    ->from(243899999999)
    ->as('Enigma972')
    ->to(243899999999)
    ;

$response = $sms->doSend($message);

dd($response->toArray());


^ array:1 [▼
  "outboundSMSMessageRequest" => array:4 [▼
    "address" => array:1 [▼
      0 => "tel:+243899999999"
    ]
    "senderAddress" => "tel:+243899999999"
    "outboundSMSTextMessage" => array:1 [▼
      "message" => "Hello world, via Orange SMS API."
    ]
    "resourceURL" => "https://api.orange.com/smsmessaging/v1/outbound/tel:+243899999999/requests/2fdd2d6e-c155-43d3-97ef-1dce0dc648d5"
  ]
]