Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Saloon Laravel Package

saloonphp/saloon

Saloon is a PHP package for building beautiful, class-based API integrations. Define connectors and requests, then handle authentication, caching, retries, pagination, and testing through a clean, framework-agnostic API that works with Laravel or any PHP project.

View on GitHub
Deep Wiki
Context7

🤠 Build beautiful API integrations and SDKs with Saloon

Frequently asked questions about Saloon
How do I install and configure Saloon in a Laravel application?
Install Saloon with composer require saloonphp/saloon. In Laravel, the package's service provider is auto-discovered, and you can bind connectors in a service provider using config values. Then define a connector for the API base URL and authentication, and create request classes for each endpoint.
What is the difference between a Saloon connector and a request class?
A connector defines shared API concerns such as the base URL, authentication, default headers, and middleware. A request class represents a single endpoint and defines its HTTP method, path, body, and expected response. This separation keeps API configuration reusable and endpoint logic focused.
Can Saloon be used outside Laravel or with any PHP framework?
Yes, Saloon is framework-agnostic and PSR-compatible, so it works in plain PHP, Symfony, or other PHP projects. It is also a PSR-18 HTTP client, which helps it fit into existing PHP HTTP ecosystems. Laravel gets first-class integration for service container bindings, config, queues, and caching.
How does Saloon handle authentication, retries, caching, and rate limiting?
Saloon handles these concerns through connector and request configuration plus middleware pipelines. You can add authentication middleware, retry middleware, response caching, and rate limiting once on a connector or per request. This keeps cross-cutting API behavior reusable instead of scattering it across application code.
How do I test API integrations built with Saloon?
Saloon provides powerful mocking and testing utilities so you can fake responses and assert outgoing requests without hitting a real API. You can define mock clients or fixtures for common endpoints and use them with PHPUnit or Pest. This makes request classes testable in isolation and keeps integration tests deterministic.
Does Saloon support Laravel queues and async API requests?
Saloon requests can be executed inside Laravel queue jobs, so slow or batch API calls run in the background instead of blocking web requests. Saloon also provides async and concurrent request capabilities plus middleware hooks that fit queue-based workflows. This is useful for webhook handlers, imports, and fan-out API calls.
What Laravel versions does Saloon support?
Saloon is framework-agnostic and offers first-class Laravel integration for modern Laravel releases. Check the package's composer.json for the exact PHP and Laravel version constraints before upgrading. It is designed to work with Laravel's service container, configuration, queues, and cache drivers.
Is Saloon production-ready and secure?
Saloon is widely used for production API integrations and includes built-in support for retries, rate limiting, and structured responses. Saloon v4.0.0 fixed critical CVEs related to SSRF, RCE, and path traversal, so keep dependencies updated with tools like Dependabot or Laravel Forge. The v4.5.0 HasApiVersion addition is purely additive and does not touch the security-sensitive surface.
How does Saloon's HasApiVersion trait in v4.5.0 work?
HasApiVersion lets a connector declare its target vendor API version once at the class level instead of embedding version strings in every request path or header. Requests inherit that connector-level version, and supporting two vendor API versions during a deprecation window becomes a two-connector pattern with no duplicated request classes. Adoption is a one-file change and does not break existing connectors.
How does Saloon compare to Guzzle, Laravel's HTTP client, or vendor SDKs?
Guzzle and Laravel's HTTP client are lower-level HTTP tools, while Saloon adds class-based connectors, request classes, middleware, caching, retries, pagination, and strong mocking utilities. Vendor SDKs may be more feature-complete for one specific API, but Saloon gives consistent structure and testability across many integrations. Benchmark maintainability, mocking needs, and customization before choosing between Saloon and a vendor SDK.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings