Flare by Spatie
    • Error Tracking
    • Performance Monitoring
  • Pricing
  • Docs
  • Insights
  • Changelog
  • Back to Flare
  • Sign in
  • Try Flare for free
  • Error Tracking
  • Performance Monitoring
  • Pricing
  • Docs
  • Insights
  • Changelog
    • Back to Flare
    • Try Flare for free
    • Sign in
Flare Flare Laravel Laravel PHP PHP JavaScript JavaScript
  • General
  • Introduction
  • Installation
  • Censoring collected data
  • Ignoring collected data
  • 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 events
  • Data Collection
  • Application info
  • Application lifecycle
  • 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
  • Logs
  • Queries
  • Redis commands
  • Requests
  • Routing
  • Server info
  • Solutions
  • Spans
  • Stacktrace arguments
  • Views
  • Older Packages
  • Flare Client PHP V1

Routing

Flare can collect information about the routing of your application. This includes:

  • The routing process to find a route to a controller
  • Middleware that is executed

This functionality is enabled by default, but you can disable it by calling ignoreRouting() on the Flare config:

$config->ignoreRequests();

Routing stages

Flare defines five routing stages:

  • Global before middleware: middleware executed for every route within your application on the request
  • Routing: the process of finding a route to a controller
  • Before middleware: middleware executed for the current route on the request
  • After middleware: middleware executed for the current route on the response
  • Global after middleware: middleware executed for every route within your application on the response

When your application doesn't have a concept of global middleware, you can still keep the following stages:

  • Routing
  • Before middleware
  • After middleware

Lastly, it is totally valid to not have any middleware at all. In that case, you can keep the routing stage.

Recording routing stages

We cannot automatically record the routing stages in our framework-agnostic version of the Flare client. You can do this manually as such:

Global before middleware

$flare->routing()->recordGlobalBeforeMiddlewareStart(time: 10);

//middleware executed for every route within your application on the request

$flare->routing()->recordGlobalBeforeMiddlewareEnd(time: 20);

When you don't have a specific start point for this stage, you can call the following at the end of the stage:

$flare->routing()->recordGlobalBeforeMiddleware(start: 10, end: 20);

Routing

$flare->routing()->recordRoutingStart(time: 30);

// The process of finding a route to a controller

$flare->routing()->recordRoutingEnd(time: 40);

When you don't have a specific start point for this stage, you can call the following at the end of the stage:

$flare->routing()->recordRouting(start: 30, end: 40);

Before middleware

$flare->routing()->recordBeforeMiddlewareStart(time: 50);

//middleware executed for the current route on the request

$flare->routing()->recordBeforeMiddlewareEnd(time: 60);

When you don't have a specific start point for this stage, you can call the following at the end of the stage:

$flare->routing()->recordBeforeMiddleware(start: 50, end: 60);

After middleware

$flare->routing()->recordAfterMiddlewareStart(time: 70);

//middleware executed for the current route on the response

$flare->routing()->recordAfterMiddlewareEnd(time: 80);

When you don't have a specific start point for this stage, you can call the following at the end of the stage:

$flare->routing()->recordAfterMiddleware(start: 70, end: 80);

Global after middleware

$flare->routing()->recordGlobalAfterMiddlewareStart(time: 90);

//middleware executed for every route within your application on the response
$flare->routing()->recordGlobalAfterMiddlewareEnd(time: 100);

When you don't have a specific start point for this stage, you can call the following at the end of the stage:

$flare->routing()->recordGlobalAfterMiddleware(start: 90, end: 100);
Requests Server info
  • On this page
  • Routing stages
  • Recording routing stages

Track errors and fix slowdowns with Flare, the full-stack application monitoring platform for Laravel, PHP & JavaScript.

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