mocean / client
PHP Client for using Mocean's API.
Installs: 2 612
Dependents: 2
Suggesters: 1
Security: 0
Stars: 6
Watchers: 2
Forks: 4
Open Issues: 2
Requires
- php: >=5.5.0 <7.1.0
- php-http/guzzle6-adapter: ^1.0 || ^2.0
Requires (Dev)
- php-http/mock-client: ^1.1.0
- phpunit/phpunit: ^4.8
This package is auto-updated.
Last update: 2024-10-29 04:36:48 UTC
README
This library requires a minimum PHP version of 5.5
This is the PHP client library for use Mocean's API. To use this, you'll need a Mocean account. Sign up for free at moceanapi.com.
Installation
To use the client library you'll need to have created a Mocean account.
To install the PHP client library using Composer.
composer require mocean/client
Usage
If you're using composer, make sure the autoloader is included in your project's bootstrap file:
require_once "vendor/autoload.php";
Create a client with your API key and secret:
use Mocean\Client; use Mocean\Client\Credentials\Basic; $mocean = new Client(new Basic('API_KEY_HERE','API_SECRET_HERE'));
Example
To use Mocean's SMS API to send an SMS message, call the $mocean->message()->send();
method.
The API can be called directly, using a simple array of parameters, the keys match the parameters of the API.
$res = $mocean->message()->send([ 'mocean-to' => '60123456789', 'mocean-from' => 'MOCEAN', 'mocean-text' => 'Hello World' ]); echo $res;
Responses
For your convenient, the API response data can be accessed either using php object
style or array
style
echo $res; //show full response string echo $res['status']; //show response status, '0' in this case echo $res->status; //same as above
Documentation
Kindly visit MoceanApi Docs for more usage
License
This library is released under the MIT License