dutycalculator / dutycalculator-php-sdk
DutyCalculator API PHP SDK
Installs: 6 726
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 3
Forks: 4
Open Issues: 0
Requires
- php: >=5.2.0
- ext-curl: *
- ext-json: *
This package is not auto-updated.
Last update: 2024-12-21 17:17:18 UTC
README
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 therequire
section of yourcomposer.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();