Flare by Spatie
  • Features
  • Pricing
  • Docs
  • Blog
  • LOG IN
  • START TRACKING
  • Home
  • Features
  • Pricing
  • Docs
  • Blog
    • Try Flare for free
    • Sign in
Flare Flare Laravel Laravel PHP PHP JavaScript JavaScript
  • General
  • Introduction
  • Installation
  • Censoring collected data
  • Ignoring collected data
  • Laravel Octane
  • Errors
  • Adding custom context
  • Customising error grouping
  • Handling errors
  • Linking to errors
  • Reporting errors
  • Sending logs to Flare
  • Performance
  • Introduction
  • Sampling
  • Limits
  • Modify spans and span events
  • Data Collection
  • Application info
  • Cache events
  • Console commands
  • Customise error report
  • Database transactions
  • Dumps
  • Errors when tracing
  • Exception context
  • External http requests
  • Filesystem operations
  • Git information
  • Glows
  • Identifying users
  • Jobs and queues
  • Laravel context
  • Livewire
  • Logs
  • Queries
  • Redis commands
  • Requests
  • Server info
  • Solutions
  • Spans
  • Stacktrace arguments
  • Views
  • Older Packages
  • Laravel Flare V1
  • Ignition

External HTTP requests

Flare can collect information about the external HTTP requests that are being made from your application. This includes:

  • The request method
  • The request URL
  • The request body size
  • The request headers
  • The response status code
  • The response body size
  • The response headers

This functionality is enabled by default, but you can disable it by ignoring the ExternalHttp collect in config.php:

use Spatie\FlareClient\Enums\CollectType;

'collects' => FlareConfig::defaultCollects(
    ignore: [CollectType::ExternalHttp],
),

You can configure the maximum number of external HTTP requests tracked while collecting data in the case of an error as follows:

'collects' => FlareConfig::defaultCollects(
    extra: [
        CollectType::ExternalHttp->value => [
            'max_items_with_errors' => 10,
        ],
    ]
),

Collecting Laravel's HTTP client requests

Requests made with the Laravel HTTP client are automatically collected by default; no additional setup is required.

Collecting Guzzle HTTP requests

Flare can automatically collect Guzzle HTTP requests. This is done by using a middleware that will be added to the Guzzle client:

use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
use Spatie\LaravelFlare\Recorders\ExternalHttpRecorder\Guzzle\FlareMiddleware;

$stack = HandlerStack::create();

$stack->push(new FlareMiddleware());

$client = new Client([
    'handler' => $stack,
]);

You can also use the FlareHandlerStack, which requires less code:

use Spatie\LaravelFlare\Recorders\ExternalHttpRecorder\Guzzle\FlareHandlerStack;

$client = new Client([
    'handler' => new FlareHandlerStack()
]);
Exception context Filesystem operations
  • On this page
  • Collecting Laravel's HTTP client requests
  • Collecting Guzzle HTTP requests

Monitor your web apps and sites from errors to slowdowns with Flare, the easiest application monitoring platform for Laravel, PHP & Javascript.

  • Platform
  • Error Tracking
  • Performance Monitoring
  • Pricing
  • Support
  • Resources
  • Blog
  • Changelog
  • Documentation
  • Affiliate program
  • Service status
  • Terms of use
  • DPA
  • Privacy & Cookie Policy
Flare