omar-ehab/laravel-aramex
Composer 安装命令:
composer require omar-ehab/laravel-aramex
包简介
Integrate Laravel with Aramex Web services
README 文档
README
Integrate your Laravel application with Aramex web services
Table of Contents
Installation
Run the following command to install the latest applicable version of the package:
composer require omar-ehab/laravel-aramex
You can publish the config-file with:
php artisan vendor:publish --provider="omar-ehab\Aramex\AramexServiceProvider" --tag="config"
You can publish the resources files with:
php artisan vendor:publish --provider="omar-ehab\Aramex\AramexServiceProvider" --tag="lang"
Environment Variables
After installation, you can add the following variables to your .env file to modify the default values of Aramex API URLs:
BASE_LIVE_URL
BASE_TEST_URL
Default values are:
BASE_LIVE_URL=https://ws.aramex.net/shippingapi.v2
BASE_TEST_URL=https://ws.sbx.aramex.net/shippingapi.v2
QuickStart
Location
Fetch Countries
This method allows users to get the world countries list.
Aramex::fetchCountries()->run();
Fetch Country
This method allows users to get details of a certain country.
Aramex::fetchCountry()
->setCode('PS')
->run();
Fetch States
This method allows users to get all the states within a certain country (country code).
Aramex::fetchStates()
->setCountryCode('AE')
->run();
Fetch Cities
This method allows users to get all the cities within a certain country (country code). And allows users to get list of the cities that start with a specific prefix. The required nodes to be filled are Client Info and Country Code.
Aramex::fetchCities()
->setCountryCode('AE')
->run();
Validate Address
This method Allows users to search for certain addresses and make sure that the address structure is correct.
Aramex::validateAddress()
->setAddress(
(new Address()) ...
)->run();
Rate
Calculate Rate
This method allows users to get rate for source/destinations shipment.
$source = (new Address()) ... ;
$destination = (new Address()) ...;
$details = (new ShipmentDetails()) ...;
Aramex::calculateRate()
->setOriginalAddress($source)
->setDestinationAddress($destination)
->setShipmentDetails($details)
->setPreferredCurrencyCode('USD')
->run();
Shipping
Create Pickup
This method allows users to create a pickup request.
$source = (new Address());
$contact = (new Contact());
$pickupItem = (new PickupItem());
$pickup = (new Pickup())
->setPickupAddress($source)
->setPickupContact($contact)
->setPickupLocation('Reception')
->setPickupDate(Carbon::now()->timestamp)
->setReadyTime(Carbon::now()->timestamp)
->setLastPickupTime(Carbon::now()->addDay()->timestamp)
->setClosingTime(Carbon::now()->addDay()->timestamp)
->setStatus('Pending')
->setReference1('')
->addPickupItem($pickupItem);
$labelInfo = (new LabelInfo())
->setReportId(9201)
->setReportType('URL');
Aramex::createPickup()
->setLabelInfo($labelInfo)
->setPickup($pickup)
->run();
Cancel Pickup
This method allows you to cancel a pickup as long as it is un-assigned or pending details.
Aramex::cancelPickup()
->setPickupGUID('PICKUP_GUID')
->run();
Create Shipments
This method allows users to create shipments on Aramex’s system.
Aramex::createShipments()->run();
Get Last Shipments Numbers Range
This method allows you to inquire about the last reserved range using a specific entity and product group
Aramex::getLastShipmentsNumbersRange()
->setEntity('ENTITY')
->setProductGroup('PRODUCT_GROUP')
->run();
Print Label
This method allows the user to print a label for an existing shipment.
$labelInfo = (new \OmarEhab\Aramex\API\Classes\LabelInfo())
->setReportId(9201)
->setReportType('URL');
Aramex::printLabel()
->setShipmentNumber('SHIPMENT_NO')
->setLabelInfo()
->run();
Reserve Shipment Number Range
This method allows you to reserve a range of shipment numbers.
Aramex::reserveShipmentNumberRange()->run();
Schedule Delivery
This method allows you to schedule the delivery of a shipment at a specified time and place (Longitude and Latitude)
Aramex::scheduleDelivery()->run();
Tracking
Track Pickup
This method allows the user to track an existing pickup’s updates and latest status.
Aramex::trackPickup()
->setReference('PICKUP_NO')
->setPickup('PICKUP') // any number
->run();
Track Shipments
This method allows the user to track an existing shipment’s updates and latest status.
Aramex::trackShipments()
->setShipments(['SHIPMENT_NO'])
->run();
omar-ehab/laravel-aramex 适用场景与选型建议
omar-ehab/laravel-aramex 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 104 次下载、GitHub Stars 达 1, 最近一次更新时间为 2021 年 10 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「aramex」 「Aramex Web services」 「Laravel Aramex」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 omar-ehab/laravel-aramex 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 omar-ehab/laravel-aramex 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 omar-ehab/laravel-aramex 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Environment processor and contexts autoloader
A PHP client for the Salesforce SOAP API
A Library to integrate with Aramex APIs
A Library to integrate with Aramex APIs
Model of a web-based resource
This package includes a script and fail2ban configuration that allows you to use fail2ban when utilizing AWS elastic load balancer (ELB) and an apache webserver.
统计信息
- 总下载量: 104
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-10-12