Lue dans les fichiers PHP du paquet au commit 9748d2557b70 : ses espaces de noms, classes, interfaces et énumérations, leurs constantes, propriétés et méthodes publiques avec leur PHPDoc, et les options que prennent ses fabriques. Rien n’en est exécuté.
ApiclassUPS's REST APIs on an OAuth2 client-credentials token, kept until it expires.
3 methods · 2 properties · 3 constants
MappingclassUPS's shapes for ours.
3 methods · 1 constant
UpsGatewayFactoryclassoptions: client_id: '%env(UPS_CLIENT_ID)%' # an app in the UPS Developer Portal client_secret: '%env(UPS_CLIENT_SECRET)%' account_number: '%env(UPS_ACCOUNT)%' # the shipper account (6 characters) sandbox: true # the Customer Integration Environment rates: [...] # optional: prices from configuration instead of the Rating API
9 options
PickupActionclassThe Locator API: UPS Access Points near an address, nearest first.
3 methods
RatingActionclassThe Rating API's Shop: every service UPS can carry the shipment with, priced.
3 methods
ShippingActionclassThe Shipping API: the shipment booked, its label (PDF by default, "GIF"/"ZPL" through the option label_format).
3 methods
TrackingActionclassThe Tracking API: the parcel's activities, oldest first.
3 methods
Omnibus\Ups
Api class
final class Api Api.php:11
UPS's REST APIs on an OAuth2 client-credentials token, kept until it expires.
const LIVE = 'https://onlinetools.ups.com'const TEST = 'https://wwwcie.ups.com'const VERSION = 'v2409'public readonly string $accountNumberpublic 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(): stringApi::call()
public function call(string $method, string $path, ?array $body = null, array $query = []): arrayMapping class
final class Mapping Mapping.php:10
UPS's shapes for ours.
const SERVICES = ['01' => 'Next Day Air', '02' => '2nd Day Air', '03' => 'Ground', '07' => 'Worldwide Express', '08' => 'Worldwide Expedited', '11' => 'Standard', '12' => '3 …
Mapping::address()
public static function address(Address $a, bool $withAttention = true): arrayMapping::package()
public static function package(Parcel $p): arrayMapping::status()
public static function status(?string $type): TrackingStatusUpsGatewayFactory class
final class UpsGatewayFactory extends GatewayFactory UpsGatewayFactory.php:21
options: client_id: '%env(UPS_CLIENT_ID)%' # an app in the UPS Developer Portal client_secret: '%env(UPS_CLIENT_SECRET)%' account_number: '%env(UPS_ACCOUNT)%' # the shipper account (6 characters) sandbox: true # the Customer Integration Environment rates: [...] # optional: prices from configuration instead of the Rating API
Options
| Option | Default | |
|---|---|---|
sandbox | false | |
omnibus.api | function (Config $c) {
$http = $this->http ?? HttpClient::create();
return new Api($http, (string) $c['client_id'], (string) $c['client_secret'], (st… | |
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 | new PickupAction() | |
client_id | required | |
client_secret | required | |
account_number | required |
Omnibus\Ups\Action
PickupAction class
final class PickupAction implements ActionInterface, ApiAwareInterface PickupAction.php:15
The Locator API: UPS Access Points near an address, nearest first.
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
The Rating API's Shop: every service UPS can carry the shipment with, priced.
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
The Shipping API: the shipment booked, its label (PDF by default, "GIF"/"ZPL" through the option label_format).
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
The Tracking API: the parcel's activities, oldest first.
TrackingAction::__construct()
public function __construct()TrackingAction::supports()
public function supports(Request $request): boolTrackingAction::execute()
public function execute(Request $request): void