https://github.com/ismaeltoe/osms-php
A PHP library to access Orange SMS API.
https://github.com/ismaeltoe/osms-php
composer orange-api orange-smsapi php php-library
Last synced: 4 months ago
JSON representation
A PHP library to access Orange SMS API.
- Host: GitHub
- URL: https://github.com/ismaeltoe/osms-php
- Owner: ismaeltoe
- License: mit
- Created: 2015-04-10T10:59:18.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2025-12-25T12:55:14.000Z (6 months ago)
- Last Synced: 2025-12-27T00:34:31.535Z (6 months ago)
- Topics: composer, orange-api, orange-smsapi, php, php-library
- Language: PHP
- Size: 22.5 KB
- Stars: 45
- Watchers: 9
- Forks: 43
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Osms
A PHP library to access Orange SMS API.
Current version: 2.0.2
## Installation
### With Composer (recommended)
Install [Composer](https://getcomposer.org/). Then, do:
$ composer require ismaeltoe/osms
### Without Composer
Simply [download the latest release](https://github.com/ismaeltoe/osms-php/archive/master.zip).
## Loading
You can load the class using Composer's autoloading:
```php
require 'vendor/autoload.php';
```
Otherwise, you can simply require the file directly:
```php
require 'path/to/Osms.php';
```
## Quick Start
**Case 1: You have no access token**
```php
require 'vendor/autoload.php';
use \Osms\Osms;
$config = array(
'clientId' => 'your_client_id',
'clientSecret' => 'your_client_secret'
);
$osms = new Osms($config);
// retrieve an access token
$response = $osms->getTokenFromConsumerKey();
if (!empty($response['access_token'])) {
$senderAddress = 'tel:+2250000';
$receiverAddress = 'tel:+22500000000';
$message = 'Hello World!';
$senderName = 'Optimus Prime';
$osms->sendSMS($senderAddress, $receiverAddress, $message, $senderName);
} else {
// error
}
```
**Case 2: You have an access token**
```php
require 'vendor/autoload.php';
use \Osms\Osms;
$config = array(
'token' => 'your_access_token'
);
$osms = new Osms($config);
$senderAddress = 'tel:+2250000';
$receiverAddress = 'tel:+22500000000';
$message = 'Hello World!';
$senderName = 'Optimus Prime';
$osms->sendSMS($senderAddress, $receiverAddress, $message, $senderName);
```
Check out [examples](https://github.com/ismaeltoe/osms-php/tree/master/examples) for more examples.
CHECK OUT also [Osms.php](https://github.com/ismaeltoe/osms-php/blob/master/src/Osms.php) to see all the methods available. But DON'T MODIFY IT. You can extend the class to add your own stuff.
## Country Sender Number
The sender address is a unique country sender number per country. You can find the list of country sender numbers [here](https://developer.orange.com/apis/sms/getting-started).
## SSL certificate problem
If you get an SSL error, set the peer's certificate checking option to false:
```php
$osms = new Osms();
$osms->setVerifyPeerSSL(false);
```
But it should work on your hosting server, so enable the certificate checking when you are ready to deploy your application for security reasons.
## Documentation
* Native API [https://developer.orange.com/apis/sms-ci/getting-started](https://developer.orange.com/apis/sms-ci/getting-started)
## Other Libraries
* [osms-android](https://github.com/ismaeltoe/osms-android)
## License
Released under the MIT License - see `LICENSE.txt` for details.