omnibus / jdl-express
Omnibus JD Logistics: waybills, interception and traces - the JD Open Platform (signed requests).
Requires
- php: >=8.2
- omnisense/contracts: ^1.0
- omnisense/omnibus: ^2.0
- symfony/http-client: ^6.4|^7.0|^8.0
Requires (Dev)
- phpunit/phpunit: ^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
JD Logistics (京东物流) for omnisense/omnibus:
orders with their waybills and labels, tracking and cancellation - the open platform's signed
ECAP APIs. Prices come from configuration (rates): JD quotes by contract.
Install and a first call
composer require omnibus/jdl-express
No account for this first call: JD Logistics's answer is recorded
(Omnibus\Testing\RecordedHttpClient answers in place of the API), so nothing leaves the process.
With your own credentials, give the factory your HTTP client (or none: it makes its own) and drop
the recorded one.
<?php require __DIR__.'/vendor/autoload.php'; use Omnibus\JdlExpress\JdlExpressGatewayFactory; use Omnibus\Testing\RecordedHttpClient; // JD Logistics's answer, recorded: no account, and nothing leaves the process. $http = new RecordedHttpClient([ '/ecap/v1/orders/trace/query' => ['code' => 0, 'data' => ['waybillCode' => 'JDV000123456789', 'traceDetails' => [ ['operateTime' => '2026-10-02 11:30:00', 'operateState' => 150, 'operateRemark' => '您的快件已签收', 'operateSite' => '北京朝阳站'], ]]], ]); $gateway = (new JdlExpressGatewayFactory($http))->create(['app_key' => 'ak', 'app_secret' => 'as', 'access_token' => 'tok', 'customer_code' => '010K123456', 'sandbox' => true]); $tracking = $gateway->track('JDV000123456789'); echo $tracking->status->value, ' - ', $tracking->latest()?->description, "\n"; // delivered - 您的快件已签收
A real call needs a JD Logistics account (the credentials below). Unverified: the request and answer shapes come from JD Logistics's published documentation, and the package has not been run against its service.
Configuration
$gateway = (new JdlExpressGatewayFactory($http))->create($options); // $http: the application's HTTP client - none given, the factory makes its own; the options below
No framework needed: the package requires omnisense/omnibus and symfony/http-client. In a
Symfony application, the same through the bundle's configuration:
omnibus: gateways: jdl_express: factory: jdl_express options: app_key: '%env(JDL_APP_KEY)%' app_secret: '%env(JDL_APP_SECRET)%' access_token: '%env(JDL_ACCESS_TOKEN)%' customer_code: '%env(JDL_CUSTOMER)%' # 商家编码 sandbox: true rates: [...]
The service is the product code (ed-m-0001 特惠送 by default, ed-m-0002 特快送...). Addresses: the
third street line carries the province. Shipment options: description, instructions,
template. No pickup points.
Credentials: an app on JD Logistics' open platform gives the app key and secret; the merchant's authorisation gives the access token and the 商家编码 (UAT first).
Built from JD Logistics' published open platform documentation and tested on recorded answers; unverified against UAT until an account's keys are at hand.
Responsibility
This package is an independent, unofficial client: it is not affiliated with, endorsed by or sponsored by JD Logistics, Inc. It reaches their service on behalf of whoever runs it, and it does not redistribute their data beyond the short excerpts recorded as test fixtures. Its MIT licence covers this package's code only and grants no right to the service or to its data.
Whoever installs and runs this package is responsible for complying with JD Logistics' terms (those of its open platform, accepted on registration: open.jdl.com), for obtaining whatever they require (an account, a key, a licence or subscription, an attribution or a citation, a rate limit to respect), and for any use made of what it returns. The authors publish it free of charge, make no commercial use of it, and accept no liability for how it is used (see LICENSE).
License: MIT since 2026-10-09; earlier versions remain published under LGPL-3.0-or-later.