PHP code example of espressobyte / firemobile-php

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

    

espressobyte / firemobile-php example snippets


 

use Firemobile\Client;
use Firemobile\FiremobileAuth;
use Firemobile\Message;
use Firemobile\Requests\Sms;
use GuzzleHttp\Client as HttpClient;

$message = Message::make()
    ->setFrom('+60123456789')
    ->setTo('+60123226789')
    ->setText('Firemobile message.');

$firemobile = Client::make(new HttpClient(),[
    'username' => 'secret',
    'password' => 'secret',
]);

$response = Sms::make($message,FiremobileAuth::make($firemobile))
->send();

echo $response->getStatusCode();
echo $response->getBody();


 

use Firemobile\Client;
use Firemobile\FiremobileAuth;
use Firemobile\Message;
use Firemobile\Requests\Sms;
use GuzzleHttp\Client as HttpClient;

$callbackUrl = 'https://demo.test/callback';

$message = Message::make()
    ->setFrom('+60123456789')
    ->setTo('+60123226789')
    ->setText('Firemobile message.');

$firemobile = Client::make(new HttpClient(),[
    'endpoint' => 'https://firemobile.send.com:8000/cgi-bin',
    'username' => 'c2VjcmV0Cg==',
    'password' => 'c2VjcmV0Cg==',
])
->callback($callbackUrl);

$response = Sms::make($message,FiremobileAuth::make($firemobile))->send();

echo $response->getStatusCode();
echo $response->getBody();

bash
composer