This is the official PHP library for Textko.com API.
You can install our library via composer.
composer require textko/php
For more info, see: Packagist
To start using this library, you need an API Access Token first.
Register to Get Your Access Token
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.
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.
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.
Usually all API responses are in the form of a SmsResponseContract
.
And if something is wrong, it will throw SmsException
.
To learn more about our REST API documentation.
See: API Documentation
Feel free to contact us. We are happy to assist.
Email: hello@textko.com
Facebook: /textko
Twitter: @textko
Chat: See our website