Coder Social home page Coder Social logo

kevinflou / esendex-php-sdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from esendex/esendex-php-sdk

0.0 0.0 0.0 2.46 MB

The Esendex PHP SDK is an easy to use client for our REST API that you can use to integrate SMS and Voice messaging into your PHP application. Also available via Packagist as esendex/sdk and PEAR.

Home Page: http://developers.esendex.com

License: BSD 3-Clause "New" or "Revised" License

Ruby 0.09% PHP 99.91%

esendex-php-sdk's Introduction

Esendex PHP Client

Build Status Latest Stable Version Latest Unstable Version License

Installation

Requirements

  • PHP >= 5.3.0
  • ext-curl enabled

The esendex-php-sdk is available to install through several methods as well as from source.

Composer

{
    "require": {
        "esendex/sdk": "2.*.*"
    }
}

Composer is not included within the repository, so you will need to retrieve it using the following command:

curl -sS https://getcomposer.org/installer | php

For installation on other platforms see getcomposer.org

We're in the default Packagist repository so just run

$ php composer.phar require esendex/sdk:2.*.*

or add the package above to your composer.json

Then just include the generated autoload.php somewhere in your code;

require_once 'path/to/vendor/autoload.php';

PEAR

Our package requires version 1.9.3 or newer

$ pear config-set auto_discover 1
$ pear install esendex.github.com/pear/Esendex

We provide a PSR-0 autoloader you can use for your convenience;

require_once 'Esendex/autoload.php';

GZIP

Download the current version here

Our autoloader may be included somewhere in your application;

require_once 'path/to/downloaded/Esendex/autoload.php';

Getting Started

Sending SMS

$message = new \Esendex\Model\DispatchMessage(
    "WebApp", // Send from
    "01234567890", // Send to any valid number
    "My Web App is SMS enabled!",
    \Esendex\Model\Message::SmsType
);
$authentication = new \Esendex\Authentication\LoginAuthentication(
    "EX000000", // Your Esendex Account Reference
    "[email protected]", // Your login email address
    "password" // Your password
);
$service = new \Esendex\DispatchService($authentication);
$result = $service->send($message);

print $result->id();
print $result->uri();

Retrieving Inbox Messages

$authentication = new \Esendex\Authentication\LoginAuthentication(
    "EX000000", // Your Esendex Account Reference
    "[email protected]", // Your login email address
    "password" // Your password
);
$service = new \Esendex\InboxService($authentication);

$result = $service->latest();

print "Total Inbox Messages: {$result->totalCount()}";
print "Fetched: {$result->count()}";
foreach ($result as $message) {
    print "Message from: {$message->originator()}, {$message->summary()}";
}

Track Message Status

$authentication = new \Esendex\Authentication\LoginAuthentication(
    "EX000000", // Your Esendex account reference
    "[email protected]", // Your login email
    "password" // Your password
);
$headerService = new \Esendex\MessageHeaderService($authentication);
$message = $headerService->message("messageId");
print_r($message->status());

Retrieving Full Message Body

$messageId = "unique-id-of-message";
$authentication = new \Esendex\Authentication\LoginAuthentication(
    "EX000000", // Your Esendex Account Reference
    "[email protected]", // Your login email address
    "password" // Your password
);
$service = new \Esendex\MessageBodyService($authentication);

$result = $service->getMessageBodyById($messageId);

print $result;

Would you like to know more?

Full REST API documentation can be found @ developers.esendex.com

Testing

Unit Tests

You will need to install composer in order to acquire the pre-requisites. This can be achieved by the following command:

$ curl -sS https://getcomposer.org/installer | php

To retrieve said pre-requisites execute the following:

$ composer.phar install

A suite of tests can be found in the test directory. To run them use the phing build utility. e.g.

$ php vendor/bin/phing

Credentials Test

You can check your account credentials using a phing task we have provided. First, ensure dependencies have been installed with composer:

$ composer.phar install

Run the check-access script:

$ vendor/bin/phing check-access
Buildfile: /home/developer/esendex-php-sdk/build.xml

EsendexSDK > check-access:

Esendex Username ? [email protected]
Esendex Password ? secret
Account Reference? EX000000

    Account credentials OK!

BUILD FINISHED

Total time: 10.0000 seconds

Issues

We hope you don't run into any issues but if you should please make use of the issue tracker on github or send an email to [email protected]

Feedback

Let us know what you think @esendex

esendex-php-sdk's People

Contributors

jimgolfgti avatar kevinflou avatar zazoomauro avatar jackthorley avatar johnj33 avatar esendexdev avatar aaronjamesford avatar andrewseward avatar codesleuth avatar doelia avatar jonathanrelf avatar moretonb avatar olitomlinson avatar slstinson avatar gaetanv avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.