1. Go to this page and download the library: Download shipper/aramex 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/ */
shipper / aramex example snippets
use Shipper\Aramex\Aramex;
'Aramex' => Shipper\Aramex\Aramex::class,
use Aramex;
"name" => 'John' // User’s Name, Sent By or in the case of the consignee, to the Attention of.
"cell_phone" => '+123456789' // Phone Number
"phone" => '+123456789' // Phone Number
"email" => '[email protected]'
"country_code" => 'US' // ISO 3166-1 Alpha-2 Code
"city" => 'New York' // City Name
"zip_code" => 10001 // Postal Code
"line1" => 'Line 1 Details'
"line2" => 'Line 2 Details'
"line3" => 'Line 3 Details'
"pickup_date" => time() // time parameter describe the date of the pickup
"ready_time" => time() // time parameter describe the ready pickup date
"last_pickup_time" => time() // time parameter
"closing_time" => time() // time parameter
"status" => 'Ready' // or Pending
"pickup_location" => 'at company's reception' // location details
"weight" => 12 // wieght of the pickup (in KG)
"volume" => 80 // volume of the pickup (in CM^3)
[
'payment_type' => '', // default value in config file
'product_group' => '', // default value in config file
'product_type' => '', // default value in config file
'weight' => 5.2, // IN KG (Kilograms)
'number_of_pieces' => 'Integer|Required',
'height' => 5, // Dimensions in CM (optional)
'width' => 3, // Dimensions in CM (optional)
'length' => 2 // Dimensions in CM (optional)
]
$originAddress = [
'line1' => 'Test string',
'city' => 'Amman',
'country_code' => 'JO'
];
$destinationAddress = [
'line1' => 'Test String',
'city' => 'Dubai',
'country_code' => 'AE'
];
$shipmentDetails = [
'weight' => 5, // KG
'number_of_pieces' => 2,
'payment_type' => 'P', // if u don't pass it, it will take the config default value
'product_group' => 'EXP', // if u don't pass it, it will take the config default value
'product_type' => 'PPX', // if u don't pass it, it will take the config default value
'height' => 5.5, // CM
'width' => 3, // CM
'length' => 2.3 // CM
];
$shipmentDetails = [
'weight' => 5, // KG
'number_of_pieces' => 2,
];
$currency = 'USD';
$data = Aramex::calculateRate($originAddress, $destinationAddress , $shipmentDetails , 'USD');
if(!$data->error){
dd($data);
}
else{
// handle $data->errors
}