alhoqbani/smsa-webservice
Composer 安装命令:
composer require alhoqbani/smsa-webservice
包简介
smsaexpress.com tracking web service (soap api)
README 文档
README
SMSAExpress tracking web service.
Under development. Don't use for production.
This library provides fluent and intuitive mechanism to interact with SMSAExpress eCommerce Web API: SMSAwebService.
Through this API you can cretate new shipments, track shipments, and cancel shipments programmatically.
The API follows SOAP protocol specifications, and it's not straight forward to follow or use with PHP.
This is unoffocial libary and has no affiliation with SMSAExpress. Usage of SMSAwebService is subject to its terms and conditions.
Credentials:
Before using the API you need to obtain a passKey from SMSAExpress.
Install
Via Composer
$ composer require alhoqbani/smsa-webservice
Usage
<?php use \Alhoqbani\SmsaWebService\Smsa; $smsa = new Smsa($passKey);
Get Status:
Get current Status of Shipment by Air waybill Number
$result = $smsa->status('290019315792'); var_dump($smsa->data);
Get Tracking
Get Tracking of Shipment by Air waybill Number
$track = $smsa->track('290019315792'); if (track->success) { var_dump($track->data); } else { var_dump($track->error); }
Get AWB Print in PDF
Get AWB Print in PDF
try { $pdf = $smsa->awbPDF('290019315810'); header('Content-type: application/octet-stream'); header('Content-disposition: attachment;filename=awb.pdf'); echo $pdf->data; die(); } catch (\Alhoqbani\SmsaWebService\Exceptions\RequestError $e) { echo $e->getMessage(); var_dump($e->smsaResponse) }
Create new shipment:
Create Shipment and get SMSA AWB Number
You create an object of Shipment and pass it to $smsa->createShipment() The shipment requeires an instance of Customer and optionally a Shipper object.
<?php use \Alhoqbani\SmsaWebService\Smsa; use \Alhoqbani\SmsaWebService\Models\Shipment; use \Alhoqbani\SmsaWebService\Models\Customer; use \Alhoqbani\SmsaWebService\Models\Shipper; $smsa = new Smsa($passKey); // Create a customer $customer = new Customer( 'Customer Name', //customer name '0500000000', // mobile number. must be > 9 digits '10 King Fahad Road', // street address 'Jeddah' // city ); $shipment = new Shipment( time(), // Refrence number $customer, // Customer object Shipment::TYPE_DLV // Shipment type. ); $awb = $smsa->createShipment($shipment); echo $awb->data; // 290019315792
To add additional fields
$customer ->setEmail('customer@example.com') ->setAddressLine2('Building 10, Apartment 1') ->setPOBox('12345') ->setZipCode('11411') ->setTel1('0110000000') ->setTel2('0120000000'); // To add shipper details to the shipment $shipper = new Shipper( 'Shipper Name (LLC)', // shipper name 'Shipper Employee', // contact name '1 Main Road', // address line 1 'Riyadh', // city 'Saudi Arabia', // country '0110000000' // phone ); $shipment->setShipper($shipper);
Cancel shipment:
Cancel a Shipment by Air waybill Number
$result = $smsa->cancel('AWB NUMBER') var_dump($result->jsonSerialize())
Get Cities
Get List of Cities for Retails list
$smsa->shouldUseExceptions = false; // Disable throwing exceptions by the library $cities = $smsa->cities(); if( $cities->success) { var_dump($cities->data) } else { var_dump($cities->error) }
Get Retails
Get Retails list by each city
$retails = $smsa->retails(); var_dump($retails); // or by city (route code): $retails = $smsa->retailsIn('TUU');
Example App
You can check this repository for an example app built with Laravel.
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
Not yet :(
TODO
- Testing!!
- Complete remaining operations.
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Credits
License
The MIT License (MIT). Please see License File for more information.
alhoqbani/smsa-webservice 适用场景与选型建议
alhoqbani/smsa-webservice 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.72k 次下载、GitHub Stars 达 18, 最近一次更新时间为 2018 年 04 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「alhoqbani」 「smsa-webservice」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 alhoqbani/smsa-webservice 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 alhoqbani/smsa-webservice 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 alhoqbani/smsa-webservice 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
统计信息
- 总下载量: 3.72k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 18
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-04-06