velostazione / besms
Simple PHP client to send SMS via BeSMS API
Installs: 11
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 1
Open Issues: 0
pkg:composer/velostazione/besms
Requires
- php: ^8.0
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- phpunit/phpunit: ^9
README
The unofficial helper library to send SMS with BeSMS.it
Installation
composer require velostazione/besms
Usage
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>);
Send SMS
$response = $besms->send('61491570156', 'hello world'); print_r($response);
Different seder
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);
Country code
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.
View credit
$response = $besms->getCredit(); print_r($response);
Tests
./vendor/bin/phpunit tests