alex-qiu / hyperf-express
1.0.8
2024-07-02 09:33 UTC
Requires
- php: >=7.3
- ext-json: *
- ext-swoole: >=4.4
- hyperf/config: 3.0.*
- hyperf/contract: 3.0.*
- hyperf/di: 3.0.*
- hyperf/guzzle: 3.0.*
- hyperf/utils: 3.0.*
- mockery/mockery: ^1.5
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.14
- hyperf/testing: 3.0.*
- phpstan/phpstan: ~0.12
- swoft/swoole-ide-helper: dev-master
README
一款查询物流信息的hyperf组件
特点
- 可兼容目前市面多家服务商
- 一套写法兼容所有平台
- 简单配置即可灵活增减服务商
- 统一的返回值格式,便于日志与监控
- 更多平台可自行接入...
平台支持
环境需求
- PHP >= 7.0
安装
$ composer require "alex-qiu/hyperf-express"
$ php bin/hyperf.php vendor:publish alex-qiu/hyperf-express
使用
use AlexQiu\Express\Express; $config = [ // HTTP 请求的超时时间(秒) 'timeout' => 5.0, // 默认配置 'default' => [ 'gateway' => 'kdniao', ], // 可用的网关配置 'gateways' => [ 'kdniao' => [ 'app_id' => '', // SDK APP ID 'api_key' => '', // APP KEY ], ], ]; /** * @var Express */ public $express; public function __construct(ExpressInterface $express) { $this->express = $express; } public function index() { return $this->express->track([ "logistic_code" => "JDVA00003618100", "shipper_code" => "JD" ]); }