The unofficial helper library to send SMS with BeSMS.it
composer require velostazione/besms
See BeSMS official documentation: https://www.besms.it/documentazione_api/Documentazione_BCP_API.pdf
require_once('vendor/autoload.php');
use Velostazione\BeSMS\Client;
use Velostazione\BeSMS\Api;
$client = new Client();
$besms = new BeSMS($client, '<USERNAME>', '<PASSWORD>', <API_ID>, <REPORT_TYPE>, <SENDER>);
$response = $besms->send('61491570156', 'hello world');
print_r($response);
Beside the sender defined when instantiating the class, a different sender can be specified on the fly upon sending a message:
$response = $besms->send('61491570156', 'hello world', <SENDER>);
print_r($response);
Since BeSMS only accepts integer recipients, country codes in the common forms of +93
, 0093
or +1-684
would not be accepted.
The send
method will take care of this automatically removing any leading plus, double zero or dash.
$response = $besms->getCredit();
print_r($response);
./vendor/bin/phpunit tests