- What is Saloon and how does it work in Laravel?
- Saloon is a Laravel/PHP package for building elegant, class-based API integrations and SDKs. Instead of scattering Http:: calls through your app, you define Connector, Request and Response classes that encapsulate each third-party API. It is Guzzle-backed and PSR-18 compatible, and it includes built-in support for authentication, caching, retries, rate limiting and testing. It fits in the service-integration layer of a typical Laravel application.
- How do I install Saloon in a Laravel app?
- Install it with Composer using composer require sammyjo20/saloon. For the v4.5 line, pin the constraint to ^4.5 rather than >=4.5 so a future v5 change is an explicit upgrade decision. Then create your Connector and Request classes and run your test suite to confirm compatibility.
- Which PHP and Laravel versions does Saloon support?
- The provided evaluation does not state the exact minimum PHP and Laravel versions for Saloon v4.5.0, so check the package's composer.json and release notes against your runtime matrix before standardising. Saloon is a library-level dependency for standard Laravel projects and does not require new infrastructure or services.
- How does Saloon handle authentication for API integrations?
- Saloon has built-in support for authentication, so credentials and auth headers can be configured at the Connector or Request level rather than duplicated across calls. The exact mechanisms depend on the upstream API and your chosen Saloon traits. Confirm the trait composition and per-request overrides in the package docs and tests.
- How do I test Saloon requests and mock API responses?
- Saloon is designed to be testable: because each API call is a class, you can mock or record responses instead of hitting the real API. The evaluation notes that existing mocking and recording are unaffected by the v4.5 release. Write tests around your connectors and requests, and add assertions that versioned connectors declare a version if you adopt HasApiVersion.
- Does Saloon support retries, rate limiting and caching?
- Yes. Saloon provides built-in support for retries, rate limiting and caching as part of its request lifecycle, so you do not need separate packages for these common resilience patterns. These behaviours are configured per connector or request. If you adopt the new HasApiVersion trait, verify in tests that it composes cleanly with your auth, caching, retry and rate-limiting traits.
- What is the HasApiVersion trait in Saloon 4.5?
- HasApiVersion is an opt-in trait added in Saloon v4.5.0 to formalise API versioning. It lets you declare the version as connector or request configuration rather than hardcoding version strings in base URLs, paths, headers or query parameters. It is additive and backward compatible, but its API surface is new and may be reshaped in v5, so avoid deep coupling. The release notes are terse, so read the source and tests before standardising, and note that the trait expresses which version, not when it expires.
- Should I upgrade from Saloon 3 to Saloon 4?
- If you are already on Saloon v4, upgrading is low effort: bump the Composer constraint from ^4.4 to ^4.5, run your full test suite, and ship, since the release is additive with no code changes required. If you are on v3, this release is not a reason to migrate; a v3 to v4 upgrade is a separate, larger effort and should be scoped independently. Adoption of HasApiVersion is incremental and per connector, with no all-or-nothing cutover.
- Is Saloon production-ready and actively maintained?
- The evaluation describes v4.5.0 as a semver-minor release with no breaking changes or deprecations, and the package is used in standard Laravel projects for outbound integrations. It does not include maintenance metrics such as release cadence or issue response time, so check the repository for that. The main production caution is organisational: treat HasApiVersion as a soft commitment because it may be reshaped in v5, and define a team convention to avoid drift. Upstream API version sunset handling remains manual.
- What are alternatives to Saloon for Laravel API integrations?
- Alternatives include Laravel's built-in Http client, direct Guzzle usage, and other SDK or API-client generators. Saloon's differentiator is its class-based Connector/Request/Response model with built-in auth, caching, retries, rate limiting and testing, which replaces ad-hoc Http:: calls with encapsulated, mockable classes. If you only need a few simple calls, the built-in client may be enough; if you are maintaining many third-party integrations, Saloon's structure is the reason to choose it.