Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Twizo

Twizo PHP API

Connect to the Twizo API using PHP. This API includes functions to send verifications (2FA), SMS and Number Lookup.

Requirements

  • PHP >= 5.4
  • Composer

Get application secret and api host

To use the Twizo API client, the following things are required:

Installation

The easiest way to start using the the Twizo API is to require it with Composer.

$ composer require twizo/lib-api-php

Getting started

Use the auto loader to load all required classes. If you're using Composer, you can skip this step and use the composer auto loader.

require "autoload.php";

Initializing the Twizo Api using your api secret and api host

$twizo = Twizo\Api\Twizo::getInstance('43reFDSrewrfet425rtefdGDSGds54twegdsgHaFST2refwd', 'api-asia-01.twizo.com');
	

Create a new verification

$verification = $twizo->createVerification('610123456789');
$verification->send();

Verify token

try {
    $result = $twizo->getTokenResult($verification->getMessageId(), '12345');

    print 'Success' . PHP_EOL;
} catch (Verification\Exception $e) {
    print 'Failed: ' . $e->getMessage() . PHP_EOL;
} catch (Twizo\Api\Exception $e) {
    print 'Exception: ' . $e->getMessage() . PHP_EOL;
}

Send sms

$sms = $twizo->createSms('test message body', '610123456789', 'sender');
$sms->sendSimple();

Examples

In the examples directory you can find a collection of cli examples of how to use the api. When first running an example you will be asked for a host name and secret; this will be written to a config file.

License

The MIT License. Copyright (c) 2016-2017 Twizo

Support

Contact: www.twizo.comsupport@twizo.com

About

PHP library for the Twizo api.

Resources

License

Packages

No packages published

Languages

You can’t perform that action at this time.