Download the PHP package shipper/aramex without Composer
On this page you can find all versions of the php package shipper/aramex. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package aramex
Aramex-PHP-SDK
Open source Laravel SDK to integrate with Aramex API's.
Installation
To publish the package and create config file aramex.php
run this command
Note that this package require
SOAP
extension on your server.
Refer to those link for installation
> php.net
> digitalocean.com
Configurations
After install the package you should publish the package in your project,
then it will create config/aramex.php
file open it and set your CientInfo and set other params depending on you business model.
NOTE: read comments in config file carefully
A Brief Documentation
First you should read the official aramex documentation, understand the flow of their API's and parameters and decide the main puroposes of using aramex API.
doucmentation link: https://www.aramex.com/docs/default-source/resourses/resourcesdata/shipping-services-api-manual.pdf
You can use the Aramex interface through:
or add it to Aliases in config/app.php file
then
However, The integration has 7 main functions:
- Create Pickup.
- Cancel Pickup.
- Create Shipment.
- Calculate Rate.
- Track Shipments.
- Fetch Countries.
- Fetch Cities.
- Validate Address.
Create Pickup Method
takes array of parameters
return stdClass :
Sample Code :
Create Shipment Method
takes array of parameters
retrun stdClass:
Error Response
Sample Code
Calculate Rate
Calculate Rate API is used to get shipment pricing and details before you ship it.
it takes 4 parameters:
Aramex::calculateRate($originAddress, $destinationAddress, $shipementDetails, $currency)
$originAddress
and $destinationAddress
are both arrays as follows:
The $shipmentDetails
parameter is an array describes some details about the shipment as follows:
The $currency
is a string (3 Chars) for prefered currency calculations like USD
,AED
,EUR
,KWD
and so on.
Note that in case you want pass the dimensions, it will not take the parameters unless you pass all the height
, width
, length
.
Sample Code
Response Object Samples
-Success Response:
-Fail Response
Track Shipments
This service show the detailed updates on the shipments you created.
Aramex::trackShipments($arrayOfShipmentIds);
Basically get the IDs of the created shipments ($createShipmentResults->Shipments->ProcessedShipment->ID
) and stack the IDs in an array and pass the array to the function.
Sample Code
Repsponse Sample
Here I should mention if you pass wrong ID (Not Shipment ID) you will see the string you passed in NonExistingWaybills
field.
Fetch Countries
Fetching Aramex's Countries that is supported by Aramex and stored in their database.
You can either get all countries or get specific country information by passing country code as an optional parameter.
Please note that i recommend to call this method and insert all the response to your database so you can get the countries from your database and it is based on their countries so you don't waste time and make it unefficient by calling this API whenever you want to process countries data.
Response Sample
Fetch Cities
Fetching Aramex's Cities by country code.
Response Sample
Validate Address
To validate addresses and skipping struggling with users' inputs thats not compatible with Aramex's end, You can validate addresses before creating pickups or shipments.
Response Sample
Hope this helps you well, Buy me a coffee ;)
MIT Licence
Copyright 2019 Moustafa Allahham
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.