Nightghos / php-dynect-api-rest

PHP wrapper for v2 of the Dynect REST API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

php-dynect-api-rest

PHP wrapper for v2 of the Dynect API. This is very much a work in progress, do not use in production.

Foreword

I no longer have access to a Dynect account so will be unable to maintain this library until further notice. If anyone wishes to continue please contact me and I can transfer or add you onto the repo.

Installation

Install Composer

$ curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer

Add the following to your require block in composer.json config:

"m4tthumphrey/php-dynect-api-rest": "dev-master"

Include Composer's autoloader:

require_once dirname(__DIR__).'/vendor/autoload.php';

Usage

try {
    $client = new Dynect\Client();
    $response = $client->api('session')->login('company_name', 'username', 'password');

    print_r($response);

    /*
    Array
    (
        [token] => ...
        [version] => 3.4.0
    )
    */
} catch (Exception $e) {
    echo '<h1>Error!</h1><p>'.$e->getMessage().'</p>';
}

About

PHP wrapper for v2 of the Dynect REST API