The OKSWeb SMS API PHP library provides convenient access to the OKS SMS API from applications written in the PHP language.
PHP 5.6.0 and later.
You can install the library via Composer. Run the following command:
composer require oksweb/api-sms-php
Don't forget to autoload it using Composer's autoload:
require_once('vendor/autoload.php');
The bindings require the following extensions in order to work properly:
If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available.
Simple usage looks like:
require_once('vendor/autoload.php');
$OKSWebSMSGateway = new \OKSWeb\SMS\Gateway(
'mKdG9gjFdmuPWbFAFn9wrAi3bwJ8V6QpNcU7sCQBF9SKtfcSbE8DSgy1Mg2fbjpp', // API Key
1, // Server ID default to 1
);
$balance = $OKSWebSMSGateway->checkBalance();
$response = $OKSWebSMSGateway->sendQuickSMS(
'+213512345678', // This is the phone number in the E.164 Format !
'Hello World !', // Your message
);
- Documentation
- Testes
- Atomisation
Get [Composer][composer].
Install dependencies:
composer install
Install dependencies as mentioned above (which will resolve PHPUnit), then you can run the test suite:
./vendor/bin/phpunit
The library uses [PHP CS Fixer][php-cs-fixer] for code formatting. Code must be formatted before PRs are submitted, otherwise CI will fail. Run the formatter with:
./vendor/bin/php-cs-fixer fix -v .