Import duty & tax calculator / HS code tariff classification SDK for PHP
PHP
Latest commit 9542a61 May 3, 2014 Ilya Pokamestov Get Requests from DutyCalculator_Client instance
Permalink
Failed to load latest commit information.
examples Initial commit Jan 30, 2014
src Get Requests from DutyCalculator_Client instance May 3, 2014
.gitignore Initial commit Jan 30, 2014
LICENSE Initial commit Jan 30, 2014
README.md Documentation update Feb 4, 2014
composer.json Initial commit Jan 30, 2014

README.md

DutyCalculator PHP SDK (v.1.0.0)

This repository contains the open source PHP SDK that allows you to access DutyCalculator from your PHP app. The SDK requires a DutyCalculator API account (go to http://www.dutycalculator.com/compare-plans/). Full documentation about DutyCalculator API you can find here.

Usage

The examples are a good place to start. The minimal you'll need to have is:

require 'dutycalculator-php-sdk/src/dutycalculator.php';

$client = new DutyCalculator_Client('YOUR_API_KEY');

/*
 * Example of getting available import to countries
 */
$countriesTo = $client->getImportToCountries();
print_r($countriesTo->getAsArray());

All API calls have function representation in the client class. But you can make an API call using next code:

try
{
    $countriesFrom = $client->sendRequest('supported-countries/from', array('display_alpha2_code' => true));
}
catch (DutyCalculator_Exception $e)
{
    error_log($e);
    $countriesFrom = null;
}

With Composer:

  • Add the "dutycalculator/dutycalculator-php-sdk": "@stable" into the require section of your composer.json.
  • Run composer install.
  • The example will look like
$client = new DutyCalculator_Client('YOUR_API_KEY');

/*
 * Example of getting available import to countries
 */
$countriesTo = $client->getImportToCountries();

Report Issues/Bugs

Bugs