1. Go to this page and download the library: Download fhferreira/easyship-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fhferreira / easyship-php example snippets
// Create the EasyshipAPI object
$token = getenv('EASYSHIP_TOKEN');
$api = new Easyship\EasyshipAPI($token);
// Get a list of categories
$response = $api->categories()->list();
// Get a shipment
$response = $api->shipments()->get('ESTEST10001');
// Buy a label for a shipment
$response = $api->labels()->buy(['easyship_shipment_id' => 'ESTEST10001']);
/**
* @throws \GuzzleHttp\Exception\ConnectException on network error
* @throws \GuzzleHttp\Exception\ClientException on 400-level errors
* @throws \GuzzleHttp\Exception\ServerException on 500-level errors
*/
// Pass custom options that will be used by the client
$api = new Easyship\EasyshipAPI($token, [
'verify' => false, // don't verify ssl certificate
'connect_timeout' => 30, // wait maximum 30 seconds before giving up
]);
// Force all the calls from this API object to a localhost server
$api->setApiHost('http://localhost:8080/');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.