2017 © Pedro Peláez
 

library bluedrone-client-php

Bluedrone API client for PHP

image

tamble/bluedrone-client-php

Bluedrone API client for PHP

  • Monday, December 7, 2015
  • by ghola
  • Repository
  • 3 Watchers
  • 0 Stars
  • 26 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

BlueDrone API PHP Client Library

Bluedrone is a fulfillment service. You can sign up for an account at https://bluedrone.com, (*1)

Requirements

Any PHP version >= 5.3 is supported., (*2)

This client is built on top of the guzzle http library and requires the json php extension., (*3)

Having the the curl php extension installed too is recommended but not required., (*4)

Installation

Via Composer:, (*5)

Create or add the following to composer.json in your project root:, (*6)

{
    "require": {
        "tamble/bluedrone-client-php": "*"
    }
}

Install composer dependencies:, (*7)

php composer.phar install

or, (*8)

composer install

Require dependencies:, (*9)

require_once("/path/to/vendor/autoload.php");

Storage

Because the Bluedrone API uses Oauth2 you will need to store the access token between requests. For this purpose two storage adapters are provided but you can use any other as long as it implements the Token\Storage\StorageInterface interface., (*10)

The bundled examples directory display various ways of using these adapters., (*11)

If you're using the Mysql adapter, you will require to create a table with the following structure (the engine can be MyISAM if you want):, (*12)

CREATE TABLE IF NOT EXISTS `bluedrone_tokens` (
  `id` int(10) unsigned NOT NULL,
  `value` varchar(255) NOT NULL,
  `eol_timestamp` int(10) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

Example

<?php

namespace Tamble\Bluedrone\Api;

use Tamble\Bluedrone\Api\Token\Storage\Pdo\Mysql;

require('../vendor/autoload.php');

/*
 * Example is passing all the data to the storage adapter instead of using a PDO instance
 */
$storage = new Mysql('bluedrone_tokens', '127.0.0.1', 'user', 'password', 'database');

$client = new Client('CLIENT_ID', 'CLIENT_SECRET', $storage);

try {
    $client->createOrUpdateProduct(
        '2345-09-F-RED',
        array(
            "sales_channel_id" => 23,
            "name" => "Gheisa Hair Pin Red",
            "unit_system" => "imperial",
            "weight" => 10,
            "length" => 4,
            "width" => 1,
            "height" => 1,
            "price" => 3.5,
            "currency_code" => "USD",
            "is_unfulfillable" => false,
            "is_fragile" => true,
            "is_dangerous" => false,
            "is_perishable" => false
        )
    );
} catch (BluedroneException $e) {
    /*
     * Any problem that occurs results in an exception being thrown.
     * Each exception offers a 'title', 'details' and 'code' (http status code)
     *
     * The lack of an exception means that the api call was successful.
     */
    echo $e->getTitle();
    echo $e->getDetail();
}

Documentation

Up-to-date API documentation at: http://docs.bluedrone.apiary.io/, (*13)

The Versions

07/12 2015

dev-master

9999999-dev https://github.com/tamble/bluedrone-client-php

Bluedrone API client for PHP

  Sources   Download

MIT

The Requires

 

by Alex Farcas

07/12 2015

0.1.6

0.1.6.0 https://github.com/tamble/bluedrone-client-php

Bluedrone API client for PHP

  Sources   Download

MIT

The Requires

 

by Alex Farcas

07/12 2015

dev-devel

dev-devel https://github.com/tamble/bluedrone-client-php

Bluedrone API client for PHP

  Sources   Download

MIT

The Requires

 

by Alex Farcas

29/07 2015

0.1.5

0.1.5.0 https://github.com/tamble/bluedrone-client-php

Bluedrone API client for PHP

  Sources   Download

MIT

The Requires

 

by Alex Farcas

15/10 2014

0.1.4

0.1.4.0 https://github.com/tamble/bluedrone-client-php

Bluedrone API client for PHP

  Sources   Download

MIT

The Requires

 

by Alex Farcas

26/09 2014

0.1.3

0.1.3.0 https://github.com/tamble/bluedrone-client-php

Bluedrone API client for PHP

  Sources   Download

MIT

The Requires

 

by Alex Farcas

17/09 2014

0.1.2

0.1.2.0 https://github.com/tamble/bluedrone-client-php

Bluedrone API client for PHP

  Sources   Download

MIT

The Requires

 

by Alex Farcas

09/09 2014

0.1.1

0.1.1.0 https://github.com/tamble/bluedrone-client-php

Bluedrone API client for PHP

  Sources   Download

MIT

The Requires

 

by Alex Farcas

14/08 2014

0.1.0

0.1.0.0 https://github.com/tamble/bluedrone-client-php

Bluedrone API client for PHP

  Sources   Download

MIT

The Requires

 

by Alex Farcas