textko / php
Official PHP library for Textko.com
Requires
- guzzlehttp/guzzle: ^6.4
This package is auto-updated.
Last update: 2024-02-21 22:01:41 UTC
README
This is the official PHP library for Textko.com API.
Installation
You can install our library via composer.
composer require textko/php
For more info, see: Packagist
Get Your API Access Token
To start using this library, you need an API Access Token first.
Register to Get Your Access Token
Quick Usage
To send a text message:
Example:
<?php require_once 'vendor/autoload.php'; $textko = new Textko\Sms('your-access-token-here'); $sms = $textko->send('09171234567', 'My awesome text message'); $sms->smsId(); // Get sms id. $sms->toNo(); // Get recipient to no. $sms->text(); // Get sms text. $sms->status(); // Get sms current status.
Get List of Sms
To get your list of sms, use the getList()
function.
Example:
<?php require_once 'vendor/autoload.php'; $textko = new Textko\Sms('your-access-token-here'); $list = $textko->getList(); $list->data(); // Get list of sms.
Get a Message
To get a specific sms, use the get($smsId)
function. The sms id is required.
Example:
<?php require_once 'vendor/autoload.php'; $textko = new Textko\Sms('your-access-token-here'); $smsId = 'ABC'; $sms = $textko->get($smsId); $sms->smsId(); // Get sms id. $sms->toNo(); // Get recipient to no. $sms->text(); // Get sms text. $sms->status(); // Get sms current status.
Response & Errors
Usually all API responses are in the form of a SmsResponseContract
.
And if something is wrong, it will throw SmsException
.
REST API Documentation
To learn more about our REST API documentation.
See: API Documentation
Need help?
Feel free to contact us. We are happy to assist.
Email: hello@textko.com
Facebook: /textko
Twitter: @textko
Chat: See our website