Skip to content

omnibus/fedex API reference

Floor
Provider · Omnibus
Version
2.x
Conformance suite
runs, no CI read
Verified for real
Its README does not say
Licence
MIT
composer require omnibus/fedex:2.x-dev

Read from the package's own PHP files at the commit ac579cd975f2: 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.

Omnibus\Fedex

  • Api class

    FedEx's REST APIs on an OAuth2 client-credentials token, kept until it expires.

    3 methods · 2 properties · 2 constants

  • FedexGatewayFactory class

    options: client_id: '%env(FEDEX_CLIENT_ID)%' # a project in the FedEx Developer Portal client_secret: '%env(FEDEX_CLIENT_SECRET)%' account_number: '%env(FEDEX_ACCOUNT)%' sandbox: true rates: [...] # optional: configured prices instead of the Rate API

    9 options

  • Mapping class

    FedEx's shapes for ours.

    4 methods

Omnibus\Fedex\Action

  • PickupAction class

    The Location API: FedEx locations that take parcels, nearest first.

    3 methods

  • RatingAction class

    The Rate API's quotes: every service, with the account's rates.

    3 methods

  • ShippingAction class

    The Ship API: the shipment booked, its label (PDF 4x6; option label_format: PDF, PNG or ZPLII).

    3 methods

  • TrackingAction class

    The Track API: the parcel's scan events, oldest first.

    3 methods

Omnibus\Fedex

Api class

final class Api Api.php:11

FedEx's REST APIs on an OAuth2 client-credentials token, kept until it expires.

const LIVE = 'https://apis.fedex.com'
const TEST = 'https://apis-sandbox.fedex.com'
public readonly string $accountNumber
public readonly bool $sandbox

Api::__construct()

public function __construct(readonly HttpClientInterface $http, readonly string $clientId, readonly string $clientSecret, public readonly string $accountNumber, public readonly bool $sandbox = false, readonly int $timeout = 20)

Api::base()

public function base(): string

Api::call()

public function call(string $method, string $path, ?array $body = null, string $locale = 'en_US'): array

FedexGatewayFactory class

final class FedexGatewayFactory extends GatewayFactory FedexGatewayFactory.php:21

options: client_id: '%env(FEDEX_CLIENT_ID)%' # a project in the FedEx Developer Portal client_secret: '%env(FEDEX_CLIENT_SECRET)%' account_number: '%env(FEDEX_ACCOUNT)%' sandbox: true rates: [...] # optional: configured prices instead of the Rate API

Options

OptionDefault
sandboxfalse
omnibus.apifunction (Config $c) { $http = $this->http ?? HttpClient::create(); return new Api($http, (string) $c['client_id'], (string) $c['client_secret'], (st…
omnibus.action.ratingstatic fn(Config $c) => $c->get('rates') ? null : new RatingAction()
omnibus.action.shippingnew ShippingAction()
omnibus.action.trackingnew TrackingAction()
omnibus.action.pickupnew PickupAction()
client_idrequired
client_secretrequired
account_numberrequired

Mapping class

final class Mapping Mapping.php:10

FedEx's shapes for ours.

Mapping::party()

public static function party(Address $a): array

Mapping::address()

public static function address(Address $a): array

Mapping::package()

public static function package(Parcel $p): array

Mapping::status()

public static function status(?string $code): TrackingStatus

Omnibus\Fedex\Action

PickupAction class

final class PickupAction implements ActionInterface, ApiAwareInterface PickupAction.php:16

The Location API: FedEx locations that take parcels, nearest first.

PickupAction::__construct()

public function __construct()

PickupAction::supports()

public function supports(Request $request): bool

PickupAction::execute()

public function execute(Request $request): void

RatingAction class

final class RatingAction implements ActionInterface, ApiAwareInterface RatingAction.php:15

The Rate API's quotes: every service, with the account's rates.

RatingAction::__construct()

public function __construct()

RatingAction::supports()

public function supports(Request $request): bool

RatingAction::execute()

public function execute(Request $request): void

ShippingAction class

final class ShippingAction implements ActionInterface, ApiAwareInterface ShippingAction.php:16

The Ship API: the shipment booked, its label (PDF 4x6; option label_format: PDF, PNG or ZPLII).

ShippingAction::__construct()

public function __construct()

ShippingAction::supports()

public function supports(Request $request): bool

ShippingAction::execute()

public function execute(Request $request): void

TrackingAction class

final class TrackingAction implements ActionInterface, ApiAwareInterface TrackingAction.php:17

The Track API: the parcel's scan events, oldest first.

TrackingAction::__construct()

public function __construct()

TrackingAction::supports()

public function supports(Request $request): bool

TrackingAction::execute()

public function execute(Request $request): void