saloonphp/saloon
Saloon is a PHP HTTP client framework for building API integrations. Define connectors and requests, handle authentication, retries, and responses, and test easily with fakes and mocking. Works great in Laravel or any PHP app.
MockClient reduces flakiness.Adopt Saloon if:
MockClient for unit/integration tests).Look elsewhere if:
requests for Python, axios for JS).For Executives: *"Saloon is a PHP-first API integration framework that lets us build and maintain third-party API connections faster, more reliably, and with less technical debt. Think of it as our ‘internal Postman’—but for developers. Instead of spending weeks writing custom HTTP clients for Stripe, Shopify, or Twilio (and then rewriting them when APIs change), Saloon gives us a standardized, reusable SDK layer. This directly impacts:
For Engineering Leaders: *"Saloon solves three critical pain points in our API ecosystem:
MockClient means we can unit test API calls without hitting real endpoints, speeding up CI/CD and reducing flaky tests. Plus, its assertion methods (e.g., assertSent(), assertResponse()) catch integration issues early.For Developers: *"Saloon is like Laravel’s answer to Retrofit (Android) or OpenAPI generators—but for PHP. Here’s why it’s a game-changer:
#[OAuth2('stripe_auth')]
class CreateCustomerRequest extends Request {
public function resolveEndpoint(): string {
return '/v1/customers';
}
public function method(): string {
return 'POST';
}
public function data(): array {
return ['name' => $this->name, 'email' => $this->email];
}
}
No more manually building URLs, headers, or JSON payloads.Saloon\Traits\HasMiddleware).public function handle() {
$response = app(CreateCustomerRequest::class)
->name('John Doe')
->email('john@example.com')
->send();
$customer = $response->json();
How can I help you explore Laravel packages today?