Saloon vs Guzzle vs SDK vs Http Facade for Laravel API Integrations
10 minutes read
Ashley Allen · 13th November 2025
What is Saloon? [Permalink](/content/blog/saloon-guzzle-or-http-facade#content-what-is-saloon "Permalink"/index.html)
Saloon is a PHP library created and maintained by Sam Carré that allows you to easily consume APIs in your PHP applications.
It uses an elegant, expressive, object-oriented approach that makes it easy to build API integrations without worrying about the underlying implementation. Saloon has many features that make it easy to build API integrations, such as authentication handling, concurrent requests, pagination, error handling, and caching.
It ships with handy default settings that make it easy for you to get started. But it also allows you to customize these settings to suit your needs.
A key benefit of Saloon is that it comes with powerful tools you can use for writing tests for your API integrations. This makes it simpler to write tests that are easy to read and maintainable.
Saloon is also an excellent choice for consuming APIs in your Laravel applications as it encourages you to abstract your code into classes, such as "connectors" and "requests", which we'll cover later in this chapter.
This chapter will focus on using Saloon v3. Specifically, we'll be using Saloon's Laravel driver, which allows us to easily integrate Saloon into our Laravel application by providing features such as:
- Artisan commands for creating new connectors and request classes
- Facade for mocking and recording requests for testing
- Access to Laravel's
HTTPsender rather than the defaultGuzzlesender
Alternatives to Saloon [Permalink](/content/blog/saloon-guzzle-or-http-facade#content-alternatives-to-saloon "Permalink"/index.html)
If you're building an API integration for your Laravel application, you can take several approaches to making HTTP requests. Let's take a quick look at some of the alternatives to Saloon:
Guzzle [Permalink](/content/blog/saloon-guzzle-or-http-facade#content-guzzle "Permalink"/index.html)
Guzzle is a popular PHP HTTP client that you can use to make HTTP requests. It's a great choice for making API requests, especially as it ships in the default installation of Laravel, so it doesn't require you to install any additional dependencies.
It is relatively straightforward to use and also has tools that you can use for mocking responses in your tests.
The core Saloon package actually uses Guzzle under the hood to make HTTP requests.
An example request using Guzzle may look something like this:
$client = new GuzzleHttp\Client();
$response = $client->get('https://api.github.com/user', [
'headers' => [
'Authorization' => 'Bearer '.config('services.github.token'),
]
]);
$statusCode = $response->getStatusCode();
$contentType = $response->getHeader('content-type')[0];
$contents = json_decode(
json: $response->getBody()->getContents(),
associative: false,
depth: 512,
flags: JSON_THROW_ON_ERROR
);
Http Facade [Permalink](/content/blog/saloon-guzzle-or-http-facade#content-http-facade "Permalink"/index.html)
The Http facade is a class that ships with Laravel that you can use to make HTTP requests. It's a wrapper around Guzzle that simplifies some of Guzzle's functionality and makes it easier to use.
In my opinion, the Http facade provides two main benefits over using Guzzle directly:
- The
Httpfacade includes many methods you can use for testing. It allows you to mock the responses for individual calls and inspect HTTP requests to ensure your application sends them with the correct data. - All the requests made via the
Httpfacade can be logged in Laravel Telescope (a package that provides a dashboard for debugging and inspecting your Laravel application).
Continuing with our GitHub example from earlier, an example request using the Http facade may look something like this:
$response = Http::withToken('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')
->get('https://api.github.com/user');
$statusCode = $response->status();
$contentType = $response->header('content-type');
$contents = $response->json();
cURL [Permalink](/content/blog/saloon-guzzle-or-http-facade#content-curl "Permalink"/index.html)
Another option that you can use to make HTTP requests is "Client for URL" (cURL). PHP supports libcurl, a library you can use to make different types of requests, such as HTTP requests.
However, although cURL is a powerful tool, it is a lot of work to use and can be verbose. For example:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.github.com/user');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer '.config('services.github.token'),
'User-Agent: My-Laravel-App'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
if(curl_errno($ch)){
echo 'Curl error: ' . curl_error($ch);
} else {
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
$contents = json_decode($output, false, 512, JSON_THROW_ON_ERROR);
}
curl_close($ch);
API SDK [Permalink](/content/blog/saloon-guzzle-or-http-facade#content-api-sdk "Permalink"/index.html)
Sometimes, you must build an API integration for your Laravel application and find that the third-party service has a software development kit (SDK) available. For instance, you may want to interact with the Stripe API to take payments from your web application's customers.
As a basic example:
use Stripe\StripeClient;
$stripe = new StripeClient(config('services.stripe.secret'));
$customer = $stripe->customers->create([
'description' => 'John Doe',
'email' => 'john@example.com',
'payment_method' => 'pm_card_visa',
]);
Should I Use Saloon? [Permalink](/content/blog/saloon-guzzle-or-http-facade#content-should-i-use-saloon "Permalink"/index.html)
When planning your API integration, you might ask, "Should I use Saloon, Guzzle, the Http facade, cURL, or the API SDK?". It's doubtful that you'll want to use cURL directly.
You may want to use Guzzle or the Http facade to build your integration. These are both perfectly valid approaches and ones I've used many times. If you're only going to send a single API request in your application, you may want to use one of these rather than installing Saloon.
If the third-party service you're using offers an SDK for interacting with their API, you may want to opt for that. If there isn't a well-maintained SDK available, you can use the Saloon package. Saloon allows you to use an object-oriented approach to building your integration code with small, focused classes that are highly testable.
No matter which of these approaches you take, I recommend writing a thin abstraction layer over your code. You can do this using interfaces and dependency injection, as we've already covered in the "Code Techniques" section. Doing this can make it easier to switch out your implementation in the future.