Read from the package's own PHP files at the commit 19ea81336a71: 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.
ApiclassAustralia Post's Shipping and Tracking API (basic auth with the API key and password, the account number in a header).
3 methods · 2 properties · 2 constants
AuspostGatewayFactoryclassoptions: api_key: '%env(AUSPOST_API_KEY)%' # Shipping and Tracking API (developers.auspost.com.au) password: '%env(AUSPOST_PASSWORD)%' account_number: '%env(AUSPOST_ACCOUNT)%' # the 10-digit charge account sandbox: true rates: [...] # optional: configured prices instead of /prices/items
10 options
MappingclassAustralia Post's shapes for ours.
4 methods · 1 constant
CancelActionclassDELETE /shipping/v1/shipments: the shipment found by its article's tracking id, deleted before it is lodged.
3 methods
GetSlipActionclassThe label of a shipment created earlier: GET /shipping/v1/shipments by tracking id gives its shipment id and product (as cancel() finds them), POST /shipping/v1/labels its PDF, as ship() asks for it.
4 methods
RatingActionclassPOST /shipping/v1/prices/items: every product the account can send the items with, priced.
3 methods
ShippingActionclassPOST /shipping/v1/shipments, then POST /shipping/v1/labels for its PDF: the label is generated asynchronously, so the result carries the label's link; the content is fetched when Australia Post says it is ready.
4 methods
TrackingActionclassGET /shipping/v1/track: the article's events, oldest first.
3 methods
Omnibus\Auspost
Api class
final class Api Api.php:11
Australia Post's Shipping and Tracking API (basic auth with the API key and password, the account number in a header).
const LIVE = 'https://digitalapi.auspost.com.au'const TEST = 'https://digitalapi.auspost.com.au/test'public readonly string $accountNumberpublic readonly bool $sandbox
Api::__construct()
public function __construct(readonly HttpClientInterface $http, readonly string $apiKey, readonly string $password, public readonly string $accountNumber, public readonly bool $sandbox = false, readonly int $timeout = 20)Api::base()
public function base(): stringApi::call()
public function call(string $method, string $path, ?array $body = null, array $query = []): array- Returns
JSON, or ['content' => binary] for a document
AuspostGatewayFactory class
final class AuspostGatewayFactory extends GatewayFactory AuspostGatewayFactory.php:24
options: api_key: '%env(AUSPOST_API_KEY)%' # Shipping and Tracking API (developers.auspost.com.au) password: '%env(AUSPOST_PASSWORD)%' account_number: '%env(AUSPOST_ACCOUNT)%' # the 10-digit charge account sandbox: true rates: [...] # optional: configured prices instead of /prices/items
No pickup points: parcel lockers and post offices are addressed as recipient addresses.
Options
| Option | Default | |
|---|---|---|
sandbox | false | |
omnibus.api | function (Config $c) {
$http = $this->http ?? HttpClient::create();
return new Api($http, (string) $c['api_key'], (string) $c['password'], (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.cancel | new CancelAction() | |
omnibus.action.get_slip | new GetSlipAction() | |
api_key | required | |
password | required | |
account_number | required |
Mapping class
final class Mapping Mapping.php:11
Australia Post's shapes for ours.
const PRODUCTS = ['PP' => 'Parcel Post', 'EXP' => 'Express Post', 'PTI8' => 'International Standard', 'ECM8' => 'International Express', 'AIR8' => 'International Economy Air']
Mapping::labelGroup()
public static function labelGroup(string $product, string $country): stringThe label group of POST /labels for a product: International abroad, Express Post for an Express product (EXP, or a contract product named so), Parcel Post otherwise.
Mapping::party()
public static function party(Address $a, ?string $state = null): arrayMapping::item()
public static function item(Parcel $p, Shipment $s, string $product): arrayMapping::status()
public static function status(?string $status): TrackingStatusOmnibus\Auspost\Action
CancelAction class
final class CancelAction implements ActionInterface, ApiAwareInterface CancelAction.php:13
DELETE /shipping/v1/shipments: the shipment found by its article's tracking id, deleted before it is lodged.
CancelAction::__construct()
public function __construct()CancelAction::supports()
public function supports(Request $request): boolCancelAction::execute()
public function execute(Request $request): voidGetSlipAction class
final class GetSlipAction implements ActionInterface, ApiAwareInterface GetSlipAction.php:20
The label of a shipment created earlier: GET /shipping/v1/shipments by tracking id gives its shipment id and product (as cancel() finds them), POST /shipping/v1/labels its PDF, as ship() asks for it.
GetSlipAction::__construct()
public function __construct()GetSlipAction::supports()
public function supports(Request $request): boolGetSlipAction::execute()
public function execute(Request $request): voidGetSlipAction::label()
public static function label(Api $api, string $shipmentId, string $group, string $layout): arrayPOST /shipping/v1/labels for a shipment id, waiting for the label's URL; the PDF is fetched when Australia Post says it is AVAILABLE.
- Returns
the label's URL and its content
RatingAction class
final class RatingAction implements ActionInterface, ApiAwareInterface RatingAction.php:19
POST /shipping/v1/prices/items: every product the account can send the items with, priced.
Australia Post prices each item on its own: a product's rate is the sum over the parcels, and a product that does not carry every parcel is not offered.
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:20
POST /shipping/v1/shipments, then POST /shipping/v1/labels for its PDF: the label is generated asynchronously, so the result carries the label's link; the content is fetched when Australia Post says it is ready.
ShippingAction::__construct()
public function __construct()ShippingAction::supports()
public function supports(Request $request): boolShippingAction::execute()
public function execute(Request $request): voidShippingAction::trackingUrl()
public static function trackingUrl(string $number): stringTrackingAction class
final class TrackingAction implements ActionInterface, ApiAwareInterface TrackingAction.php:16
GET /shipping/v1/track: the article's events, oldest first.
TrackingAction::__construct()
public function __construct()TrackingAction::supports()
public function supports(Request $request): boolTrackingAction::execute()
public function execute(Request $request): void