exactsports/fedex
exactsports/fedex is a Laravel/PHP wrapper for the FedEx API, aiming to simplify shipping rate quotes, label creation, tracking, and address validation in your applications. Early-stage and lightly adopted, so expect limited documentation and review before production use.
This package wraps FedEx's print/document-submission flow for Laravel apps, letting you hand off PDFs (statements, invoices, labels, letters) for physical printing without hand-rolling the HTTP client. The current release is 1.0.2.
^1.0.2 rather than ^1.0. The 1.0.2 fix only matters for a narrow input (single-page, single-sided documents), and pinning guarantees you actually get it after composer update.php artisan vendor:publish) and fill in credentials from .env. Confirm whether the package ships separate sandbox/production base URLs and an account number distinct from the API key — that split trips people up on first run.single_sided, duplex, media size, and quantity. Set them explicitly rather than relying on package defaults; the 1.0.2 bug is precisely a case where the default path and the explicit path behaved differently.local — the FedEx error text is the fastest route to understanding a rejection.Wrap submission in a queued job. Printing is a network call to a third party with unpredictable latency. Dispatch a job from your controller, keep the HTTP request fast, and let the queue handle retries. Store the identifier returned by the submission (job/order/document id) on your own model so you can reconcile later.
Build a DTO for print options. Rather than scattering ['single_sided' => true, 'pages' => ...] arrays through controllers, centralise them:
final class PrintRequest
{
public function __construct(
public string $diskPath,
public int $copies = 1,
public bool $singleSided = true,
public string $mediaSize = 'LETTER',
) {}
}
Then a single mapper converts the DTO to whatever array/object the package expects. When the package's payload shape changes in a future minor, you edit one file.
Resolve documents from a Storage disk, not a raw path. Storage::disk('documents')->path($file) works locally; on S3 you generally need either a stream, a temporary URL, or a local temp copy first. Read the package's accepted input types before assuming a path string is enough.
Validate before you send. Cheap local checks save expensive round-trips: MIME type, file size against the carrier's limit, page count, and page dimensions. Use a PDF library to read the page count for real — do not infer it from file size or from the source template, because generated documents merge and drop pages in ways templates do not predict.
Test with HTTP fakes. Point the package at the sandbox and assert on the outgoing payload rather than on FedEx's response. A test that snapshots the request body for a one-page single-sided document is worth writing today; it is the cheapest guard against a repeat of the 1.0.2 regression.
vendor/ if the change is small, and read the source of the request builder before upgrading in production.$tries/backoff you control, and make the submission idempotent on your side (a print_jobs table with a unique key on your document id).How can I help you explore Laravel packages today?