2017 © Pedro Peláez
 

library zensend

ZenSend PHP Library

image

zensend/zensend

ZenSend PHP Library

  • Monday, December 19, 2016
  • by zensend
  • Repository
  • 6 Watchers
  • 3 Stars
  • 3,045 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 2 Open issues
  • 8 Versions
  • 16 % Grown

The README.md

Build Status, (*1)

ZenSend PHP bindings

You can sign up for a ZenSend account at https://zensend.io., (*2)

Requirements

PHP 5.3.3 and later., (*3)

Composer

You can install the bindings via Composer. Add this to your composer.json:, (*4)

{
  "require": {
    "zensend/zensend": "1.0.4"
  }
}

Then install via:, (*5)

composer install

To use the bindings, use Composer's autoload:, (*6)

require_once('vendor/autoload.php');

Manual Installation

If you do not wish to use Composer, you can download the latest release. Then, to use the bindings, include the init.php file., (*7)

require_once('/path/to/zensend_php_api/init.php');

Getting Started

Simple usage looks like:, (*8)

$client = new ZenSend\Client("api_key");
$request = new ZenSend\SmsRequest();
$request->body = "BODY";
$request->originator = "ORIG";
$request->numbers = ["447700000000"];
$result = $client->send_sms($request);
echo $result->numbers;
echo $result->sms_parts;
echo $result->encoding;
echo $result->tx_guid;

Verify Getting Started

After authenticating the user display the verify iframe using the following code:, (*9)

<?php
  session_start();
  $verify = new ZenSend\Verify("api_key");
  $verify->create_session("441234567890"); // the number you want to verify
  $verify->write_tags("https://" . $_SERVER['HTTP_HOST'] . "/verify_callback.php");
?>

Create another file called verify_callback.php to handle verification:, (*10)

<?php
  session_start();
  $verify = new ZenSend\Verify("api_key");
  try {
    $verify->verify_response("441234567890");  // the number you want to verify
    // handle verification success
  } catch (Exception $e) {
    // handle verification failed
  }
?>

Documentation

Please see https://zensend.io/public/docs for up-to-date documentation., (*11)

Certificate Errors

If you receive errors like:, (*12)

"SSL certificate problem: unable to get local issuer certificate"

This is likely because your php curl is not set up with a certificate bundle. This can be fixed by following the instructions here: https://support.zend.com/hc/en-us/articles/204159368-PHP-CURL-HTTPS-Error-SSL-certificate-problem-unable-to-get-local-issuer-certificate-, (*13)

Or alternatively we have included the CA certificates that we require in a bundle which can be used by creating the ZenSend Client like:, (*14)

$client = ZenSend\Client::newWithHardcodedCA("api_key");, (*15)

String Encoding

All strings sent to the API should be UTF-8 encoded., (*16)

Tests

In order to run tests first install PHPUnit via Composer:, (*17)

composer update --dev

To run the test suite:, (*18)

./vendor/bin/phpunit

Manual Testing

~/.composer/vendor/bin/psysh
>>> require('./init.php')
>>> $client = new ZenSend\Client("api_key", array(), "http://127.0.0.1:8084", "http://verify.fonix.dev");
>>> $response = $client->lookup_operator("441234567890");
>>> $client->create_msisdn_verification("441234567890");
>>> $client->msisdn_verification_status("a33d10fe587096a0b70d3701fc2c9f7e")
>>> $verify = new ZenSend\Verify("api_key", array(), "http://verify.fonix.dev");
>>> $verify->create_session("441234567890")
>>> $verify->write_tags("callback");

The Versions

19/12 2016

dev-add_sub_accounts

dev-add_sub_accounts

ZenSend PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *

 

The Development Requires

by Avatar zensend

15/06 2016

dev-master

9999999-dev

ZenSend PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *

 

The Development Requires

by Avatar zensend

15/06 2016

1.0.4

1.0.4.0

ZenSend PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *

 

The Development Requires

by Avatar zensend

05/05 2016

dev-keywords_api

dev-keywords_api

ZenSend PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *

 

The Development Requires

by Avatar zensend

13/04 2016

1.0.3

1.0.3.0

ZenSend PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *

 

The Development Requires

by Avatar zensend

13/04 2016

1.0.2

1.0.2.0

ZenSend PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *

 

The Development Requires

by Avatar zensend

17/11 2015

1.0.1

1.0.1.0

ZenSend PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *

 

The Development Requires

by Avatar zensend

17/08 2015

1.0.0

1.0.0.0

ZenSend PHP Library

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-curl *
  • ext-json *

 

The Development Requires

by Avatar zensend