PHP code example of mhabibi / aftership-php-sdk
1. Go to this page and download the library: Download mhabibi/aftership-php-sdk 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/ */
mhabibi / aftership-php-sdk example snippets
composer
$couriers = new AfterShip\Couriers('AFTERSHIP_API_KEY');
$response = $couriers->get();
$couriers = new AfterShip\Couriers('AFTERSHIP_API_KEY');
$response = $couriers->get_all();
$courier = new AfterShip\Couriers('AFTERSHIP_API_KEY');
$response = $courier->detect('1234567890Z');
$trackings = new AfterShip\Trackings('AFTERSHIP_API_KEY');
$tracking_info = array(
'slug' => 'dhl',
'title' => 'My Title',
);
$response = $trackings->create('RA123456789US', $tracking_info);
$trackings = new AfterShip\Trackings('AFTERSHIP_API_KEY');
$response = $trackings->delete('dhl', 'RA123456789US');
$trackings = new AfterShip\Trackings('AFTERSHIP_API_KEY');
$response = $trackings->delete_by_id('53df4a90868a6df243b6efd8');
$trackings = new AfterShip\Trackings('AFTERSHIP_API_KEY');
$options = array(
'page'=>1,
'limit'=>10
);
$response = $trackings->get_all($options)
$trackings = new AfterShip\Trackings('AFTERSHIP_API_KEY');
$response = $trackings->get('dhl', 'RA123456789US', array('title','order_id'));
$trackings = new AfterShip\Trackings('AFTERSHIP_API_KEY');
$response = $trackings->get_by_id('53df4a90868a6df243b6efd8', array('title','order_id'));
$trackings = new AfterShip\Trackings('AFTERSHIP_API_KEY');
$params = array(
'smses' => array(),
'emails' => array(),
'title' => '',
'customer_name' => '',
'order_id' => '',
'order_id_path' => '',
'custom_fields' => array()
);
$response = $trackings->update('dhl', 'RA123456789US', $params);
$trackings = new AfterShip\Trackings('AFTERSHIP_API_KEY');
$params = array(
'smses' => array(),
'emails' => array(),
'title' => '',
'customer_name' => '',
'order_id' => '',
'order_id_path' => '',
'custom_fields' => array()
);
$response = $trackings->update_by_id('53df4a90868a6df243b6efd8', $params);
$trackings = new AfterShip\Trackings('AFTERSHIP_API_KEY');
$response = $trackings->retrack('dhl','RA123456789US');
$trackings = new AfterShip\Trackings('AFTERSHIP_API_KEY');
$response = $trackings->retrack_by_id('53df4a90868a6df243b6efd8');
$last_check_point = new AfterShip\LastCheckPoint('AFTERSHIP_API_KEY');
$response = $last_check_point->get('dhl','RA123456789US');
$last_check_point = new AfterShip\LastCheckPoint('AFTERSHIP_API_KEY');
$response = $last_check_point->get_by_id('53df4a90868a6df243b6efd8');
$notifications = new AfterShip\Notifications('AFTERSHIP_API_KEY');
$response = $notifications->create('ups', '1ZV90R483A33906706', array(
'emails' => ['[email protected] ']
))
$notifications = new AfterShip\Notifications('AFTERSHIP_API_KEY');
$response = $notifications->create_by_id('53df4a90868a6df243b6efd8');
$notifications = new AfterShip\Notifications('AFTERSHIP_API_KEY');
$response = $notifications->delete('ups', '1ZV90R483A33906706', array(
'emails' => ['[email protected] ']
)));
$notifications = new AfterShip\Notifications('AFTERSHIP_API_KEY');
$response = $notifications->delete_by_id('53df4d66868a6df243b6f882'));
$notifications = new AfterShip\Notifications('AFTERSHIP_API_KEY');
$response = $notifications->get('dhl', '2254095771'));
$notifications = new AfterShip\Notifications('AFTERSHIP_API_KEY');
$response = $notifications->get_by_id('53df4a90868a6df243b6efd8', array('fields' => 'customer_name'));