PHP Client for using Alsaad's API.
This library requires a minimum PHP version of 7.1
This is the PHP client library for use Alsaad2's API. To use this, you'll need a Alsaad2 account.
To install the PHP client library to your project, we recommend using Composer.
composer install abdallahmohammed/alsaad-php
If you're using Composer, make sure the autoloader is included in your project's bootstrap file:
Create a client with your Username and Password:
$client = new Alsaad\Client([ 'username' => ALSAAD2_USERNAME, 'password' => ALSAAD2_PASSWORD, ]);
To use Alsaad2's SMS API to send an SMS message, call the
$message = $client->message()->send([ 'to' => ALSAAD2_TO, //can be array of numbers or string 'from' => ALSAAD2_SENDER, 'message' => 'Hello World' ]);
The API response data can be accessed as array properties of the message.
When things go wrong, you'll receive an Exception. The exception class
Alsaad\Client\Exception\Request support an additional
getEntity() method which you can use in addition to
getMessage() to find out more about what went wrong. The entity returned will typically be an object related to the operation, or the response object from the API call.