releans / releansapi
The Releans SDK enables developers to use Releans Services in their code. You can get started in minutes.
Installs: 6 156
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.4.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- apimatic/jsonmapper: ~1.3.0
- mashape/unirest-php: ~3.0.1
Requires (Dev)
- phpunit/phpunit: 4.8.*
- squizlabs/php_codesniffer: ^2.7
This package is auto-updated.
Last update: 2022-07-14 08:34:44 UTC
README
The Releans SDK enables developers to use Releans Services in their code. You can get started in minutes.
composer require releans/releansapi
Create Releans Account
First, sign up for a Releans account if you don't already have one, and make a note of your API key on the dashboard API page.
Initialization
Authentication
In order to setup authentication and initialization of the API client, you need the following information.
Parameter | Description |
---|---|
oAuthAccessToken | Your API KEY |
API client can be initialized as following.
$oAuthAccessToken = 'oAuthAccessToken'; // OAuth 2.0 Access Token $client = new ReleansAPILib\ReleansAPIClient($oAuthAccessToken);
Class Reference
List of Controllers
MessageController
Get singleton instance
The singleton instance of the MessageController
class can be accessed from the API Client.
$message = $client->getMessage();
getAllMessages
List all messages sent by the account.
function getAllMessages($accept)
Parameters
Parameter | Tags | Description |
---|---|---|
accept | Required |
/ |
Example Usage
$accept = '*/*'; $result = $message->getAllMessages($accept);
getViewMessage
Return the details of the message.
function getViewMessage( $id, $accept)
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
Message ID |
accept | Required |
/ |
Example Usage
$id = 'id'; $accept = '*/*'; $result = $message->getViewMessage($id, $accept);
createSendSMSMessage
Send a single message.
function createSendSMSMessage( $accept, $senderId, $mobileNumber, $body)
Parameters
Parameter | Tags | Description |
---|---|---|
accept | Required |
Accept |
senderId | Required |
Sender id to send the message from. |
mobileNumber | Required |
The mobile number supposed to receive the message. |
body | Required |
Message text. |
Example Usage
$accept = 'Accept'; $senderId = 'senderId'; $mobileNumber = 'mobileNumber'; $body = 'message'; $result = $message->createSendSMSMessage($accept, $senderId, $mobileNumber, $body);
Full Code Example Usage
use ReleansAPILib\APIException; use ReleansAPILib\ReleansAPIClient; $oAuthAccessToken = 'YOUR_API_KEY'; // OAuth 2.0 Access Token $client = new ReleansAPIClient($oAuthAccessToken); $message = $client->getMessage(); $accept = 'Accept'; $senderId = 'Sender_Name_ID'; $mobileNumber = '+44123456789'; $body = 'Hello from Releans'; $result = $message->createSendSMSMessage($accept, $senderId, $mobileNumber, $body);
SenderController
Get singleton instance
The singleton instance of the SenderController
class can be accessed from the API Client.
$sender = $client->getSender();
getSenderNameDetails
Return the details of the sender name.
function getSenderNameDetails( $id, $accept)
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
TODO: Add a parameter description |
accept | Required |
TODO: Add a parameter description |
Example Usage
$id = 'sender-id'; $accept = '*/*'; $result = $sender->getSenderNameDetails($id, $accept);
createSenderName
Create a new sender id to send messages using it
function createSenderName( $accept, $contentType, $body)
Parameters
Parameter | Tags | Description |
---|---|---|
accept | Required |
TODO: Add a parameter description |
contentType | Required |
TODO: Add a parameter description |
body | Required |
TODO: Add a parameter description |
Example Usage
$accept = 'text/plain'; $contentType = 'text/plain'; $body = 'Your sender name'; $result = $sender->createSenderName($accept, $contentType, $body);
getAllSenders
List all senders names associated with the account
function getAllSenders($accept)
Parameters
Parameter | Tags | Description |
---|---|---|
accept | Required |
TODO: Add a parameter description |
Example Usage
$accept = '*/*'; $result = $sender->getAllSenders($accept);
BalanceController
Get singleton instance
The singleton instance of the BalanceController
class can be accessed from the API Client.
$balance = $client->getBalance();
getBalance
Get your available balance
function getBalance($accept)
Parameters
Parameter | Tags | Description |
---|---|---|
accept | Required |
TODO: Add a parameter description |
Example Usage
$accept = 'text/plain'; $result = $balance->getBalance($accept);
=======
Getting started
The Releans SDK enables developers to use Releans Services in their code. You can get started in minutes.
composer require releans/php-client-sdk
Initialization
Authentication
In order to setup authentication and initialization of the API client, you need the following information.
Parameter | Description |
---|---|
oAuthAccessToken | OAuth 2.0 Access Token |
API client can be initialized as following.
$oAuthAccessToken = 'oAuthAccessToken'; // OAuth 2.0 Access Token $client = new ReleansAPILib\ReleansAPIClient($oAuthAccessToken);
Class Reference
List of Controllers
MessageController
Get singleton instance
The singleton instance of the MessageController
class can be accessed from the API Client.
$message = $client->getMessage();
getAllMessages
List all messages sent by the account.
function getAllMessages($accept)
Parameters
Parameter | Tags | Description |
---|---|---|
accept | Required |
TODO: Add a parameter description |
Example Usage
$accept = '*/*'; $result = $message->getAllMessages($accept);
getViewMessage
Return the details of the message.
function getViewMessage( $id, $accept)
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
TODO: Add a parameter description |
accept | Required |
TODO: Add a parameter description |
Example Usage
$id = 'id'; $accept = '*/*'; $result = $message->getViewMessage($id, $accept);
createSendSMSMessage
Send a single message.
function createSendSMSMessage( $accept, $senderId, $mobileNumber, $message)
Parameters
Parameter | Tags | Description |
---|---|---|
accept | Required |
TODO: Add a parameter description |
senderId | Required |
Sender id to send the message from. |
mobileNumber | Required |
The mobile number supposed to receive the message. |
message | Required |
Message text. |
Example Usage
$accept = 'Accept'; $senderId = 'senderId'; $mobileNumber = 'mobileNumber'; $message = 'message'; $result = $message->createSendSMSMessage($accept, $senderId, $mobileNumber, $message);
SenderController
Get singleton instance
The singleton instance of the SenderController
class can be accessed from the API Client.
$sender = $client->getSender();
getSenderNameDetails
Return the details of the sender name.
function getSenderNameDetails( $id, $accept)
Parameters
Parameter | Tags | Description |
---|---|---|
id | Required |
TODO: Add a parameter description |
accept | Required |
TODO: Add a parameter description |
Example Usage
$id = 'sender-id'; $accept = '*/*'; $result = $sender->getSenderNameDetails($id, $accept);
createSenderName
Create a new sender id to send messages using it
function createSenderName( $accept, $contentType, $body)
Parameters
Parameter | Tags | Description |
---|---|---|
accept | Required |
TODO: Add a parameter description |
contentType | Required |
TODO: Add a parameter description |
body | Required |
TODO: Add a parameter description |
Example Usage
$accept = 'text/plain'; $contentType = 'text/plain'; $body = 'Your sender name'; $result = $sender->createSenderName($accept, $contentType, $body);
getAllSenders
List all senders names associated with the account
function getAllSenders($accept)
Parameters
Parameter | Tags | Description |
---|---|---|
accept | Required |
TODO: Add a parameter description |
Example Usage
$accept = '*/*'; $result = $sender->getAllSenders($accept);
BalanceController
Get singleton instance
The singleton instance of the BalanceController
class can be accessed from the API Client.
$balance = $client->getBalance();
getBalance
Get your available balance
function getBalance($accept)
Parameters
Parameter | Tags | Description |
---|---|---|
accept | Required |
TODO: Add a parameter description |
Example Usage
$accept = 'text/plain'; $result = $balance->getBalance($accept);