Official Shipmile API library client for PHP
Make sure you have composer installed.
Add the following to your composer.json
{
"require": {
"shipmile/shipmile": "*"
}
}
Update your dependencies
$ php composer.phar update
This package follows the
PSR-0
convention names for its classes, which means you can easily integrate these classes loading in your own autoloader.
Works with [ 5.4 / 5.5 / 5.6 ]
<?php
// This file is generated by Composer
require_once 'vendor/autoload.php';
// Then we instantiate a client (as shown below)
$client = new Shipmile\Client('token', $clientOptions);
The following options are available while instantiating a client:
- base: Base url for the api
- api_version: Default version of the api (to be used in url)
- user_agent: Default user-agent for all requests
- headers: Default headers for all requests
- request_type: Default format of the request body
All the callbacks provided to an api call will receive the response as shown below
$response = $client->klass('args')->method('args', $methodOptions);
$response->code;
// >>> 200
$response->headers;
// >>> array('x-server' => 'nginx')