Read from the package's own PHP files at the commit 19040f83af96: its namespaces, classes, interfaces and enums, their public constants, properties and methods with their PHPDoc, and the options its factories take. Nothing of it is run.
ApiclassDHL Express's MyDHL API (basic auth, API key and secret), and DHL's location finder (its own key).
3 methods · 3 properties · 3 constants
DhlGatewayFactoryclassoptions: api_key: '%env(DHL_API_KEY)%' # a MyDHL API app (developer.dhl.com) api_secret: '%env(DHL_API_SECRET)%' account_number: '%env(DHL_ACCOUNT)%' # the export account sandbox: true location_api_key: null # optional, DHL's Location Finder (service points) rates: [...] # optional: configured prices instead of the rates API
10 options
MappingclassMyDHL's shapes for ours.
3 methods
PickupActionclassDHL's Location Finder: service points near an address (its own API key).
3 methods
RatingActionclassPOST /rates: every product DHL Express offers for the shipment, priced with the account's rates.
3 methods
ShippingActionclassPOST /shipments: the shipment booked with the product chosen (service: a product code, "P" by default), its label as PDF.
3 methods
TrackingActionclassGET /shipments/{id}/tracking: the shipment's events, oldest first.
3 methods
Omnibus\Dhl
Api class
final class Api Api.php:11
DHL Express's MyDHL API (basic auth, API key and secret), and DHL's location finder (its own key).
const LIVE = 'https://express.api.dhl.com/mydhlapi'const TEST = 'https://express.api.dhl.com/mydhlapi/test'const LOCATIONS = 'https://api.dhl.com/location-finder/v1/find-by-address'public readonly string $accountNumberpublic readonly bool $sandboxpublic readonly ?string $locationApiKey
Api::__construct()
public function __construct(readonly HttpClientInterface $http, readonly string $apiKey, readonly string $apiSecret, public readonly string $accountNumber, public readonly bool $sandbox = false, public readonly ?string $locationApiKey = null, readonly int $timeout = 20)Api::call()
public function call(string $method, string $path, ?array $body = null, array $query = []): arrayApi::locations()
public function locations(array $query): arrayDhlGatewayFactory class
final class DhlGatewayFactory extends GatewayFactory DhlGatewayFactory.php:22
options: api_key: '%env(DHL_API_KEY)%' # a MyDHL API app (developer.dhl.com) api_secret: '%env(DHL_API_SECRET)%' account_number: '%env(DHL_ACCOUNT)%' # the export account sandbox: true location_api_key: null # optional, DHL's Location Finder (service points) rates: [...] # optional: configured prices instead of the rates API
Options
| Option | Default | |
|---|---|---|
sandbox | false | |
location_api_key | null | |
omnibus.api | function (Config $c) {
$http = $this->http ?? HttpClient::create();
return new Api($http, (string) $c['api_key'], (string) $c['api_secret'], (string)… | |
omnibus.action.rating | static fn(Config $c) => $c->get('rates') ? null : new RatingAction() | |
omnibus.action.shipping | new ShippingAction() | |
omnibus.action.tracking | new TrackingAction() | |
omnibus.action.pickup | static fn(Config $c) => $c['location_api_key'] ? new PickupAction() : null | |
api_key | required | |
api_secret | required | |
account_number | required |
Mapping class
final class Mapping Mapping.php:10
MyDHL's shapes for ours.
Mapping::details()
public static function details(Address $a): arrayMapping::package()
public static function package(Parcel $p): arrayMapping::status()
public static function status(?string $code): TrackingStatusOmnibus\Dhl\Action
PickupAction class
final class PickupAction implements ActionInterface, ApiAwareInterface PickupAction.php:15
DHL's Location Finder: service points near an address (its own API key).
PickupAction::__construct()
public function __construct()PickupAction::supports()
public function supports(Request $request): boolPickupAction::execute()
public function execute(Request $request): voidRatingAction class
final class RatingAction implements ActionInterface, ApiAwareInterface RatingAction.php:15
POST /rates: every product DHL Express offers for the shipment, priced with the account's rates.
RatingAction::__construct()
public function __construct()RatingAction::supports()
public function supports(Request $request): boolRatingAction::execute()
public function execute(Request $request): voidShippingAction class
final class ShippingAction implements ActionInterface, ApiAwareInterface ShippingAction.php:16
POST /shipments: the shipment booked with the product chosen (service: a product code, "P" by default), its label as PDF.
ShippingAction::__construct()
public function __construct()ShippingAction::supports()
public function supports(Request $request): boolShippingAction::execute()
public function execute(Request $request): voidTrackingAction class
final class TrackingAction implements ActionInterface, ApiAwareInterface TrackingAction.php:17
GET /shipments/{id}/tracking: the shipment's events, oldest first.
TrackingAction::__construct()
public function __construct()TrackingAction::supports()
public function supports(Request $request): boolTrackingAction::execute()
public function execute(Request $request): void