- What is Laravel Transporter used for?
- Laravel Transporter provides an object-oriented, class-based approach to outbound API requests in Laravel. You typically define one Transporter per vendor for base URI, headers, and auth, one Request per endpoint for method, path, and payload, and one Response per payload shape for typed DTO mapping. It is a transport-and-mapping convention for organizing integrations, not an OpenAPI client generator.
- How do I install juststeveking/laravel-transporter in Laravel?
- Install it with Composer using composer require juststeveking/laravel-transporter. Laravel package auto-discovery registers the service provider, so no manual bootstrap work is normally needed. After install, you can optionally publish config/transporter.php and begin subclassing Transporter, Request, and Response classes per vendor.
- Do I need to publish the Transporter config file?
- Publishing config/transporter.php is optional. The package works after install and auto-discovery, and publishing is for projects that need to adjust package-level configuration. Start with defaults and publish only when you need to customize behavior.
- How do I create a Transporter for a third-party API?
- Create a class that extends the package Transporter and set the vendor base URI, headers, and auth there. Add Request classes for each endpoint with method, path, and payload, and Response classes for the payload shape. Keep each class thin so replacing the library later remains a sprint rather than a quarter.
- What is the difference between a Transporter, Request, and Response in Laravel Transporter?
- A Transporter represents the vendor or service and holds shared configuration such as base URI, headers, and auth. A Request represents one endpoint call with its method, path, and payload. A Response represents the payload shape and is typically used as a typed DTO for mapping.
- Which Laravel versions does Laravel Transporter support?
- Support depends on the package's 4.x support matrix and its Composer constraints, so verify the current PHP and Laravel requirements before adopting. Check the package README and composer.json for the exact version ranges. If you are on a 3.x release, treat a 4.x upgrade as separate coordinated work with changelog review.
- Can I test Laravel Transporter requests with Http::fake?
- Yes. Because Transporter delegates to Laravel's HTTP client, Http::fake() and existing Laravel HTTP assertions work unchanged. That allows integration tests to run deterministically in CI without network access. You should still write coverage for your own Request and Response mapping classes.
- How does Laravel Transporter handle authentication, OAuth refresh, or request signing?
- Transporter can hold vendor-level headers and auth configuration in the Transporter class. Heavy authentication scope such as OAuth refresh orchestration, mTLS, request signing, and multi-tenant token rotation is a risk area and should be verified against the source before relying on it. For complex auth flows, keep orchestration outside the thin transport classes or plan additional work.
- What changed in Laravel Transporter 4.0.1 and does it break existing code?
- 4.0.1 is a drop-in update within the ^4.0 constraint. It makes the Pool parameter nullable in ensureRequest, which is a type-widening change: callers already passing a Pool are unaffected, and callers passing null stop throwing a TypeError. Release notes do not clarify what happens at runtime when Pool is null, so confirm against source and tests before building latency-sensitive fan-out features.
- Is juststeveking/laravel-transporter production-ready, and what are the alternatives?
- It is MIT-licensed with around 479 stars, zero dependents, and effectively one primary maintainer, so treat it as low blast radius but low ecosystem validation. Keep Transporters thin and log the dependency with a named owner so replacement remains feasible. The realistic alternative is building and owning an internal HTTP wrapper with base client, auth handling, retry and timeout policy, response hydration, and test fakes.