Flare logo
Flare Laravel Error Tracking
  • Features
  • Pricing
  • Docs
  • Blog
  • Log in
  • Start tracking
FlareFlare Laravel Error Tracking
    ⌘K

    1Flare

    • 1.1General
      • Welcome to Flare
      • Getting started
      • Working with errors
      • Working with error occurrences
      • AI powered solutions
      • Searching errors
      • Sharing errors
      • Spike protection
      • Error grouping
      • GitHub integration
      • Jira integration
      • GitLab integration
      • Linear integration
      • Using the API
    • 1.2Notifications
      • Configuring notifications
      • Mail
      • Slack
      • Telegram
      • SMS
      • Webhooks
      • Discord
      • Microsoft Teams

    2Laravel

    • 2.1General
      • Introduction
      • Installation
      • Censoring Collected Data
      • Ignoring Collected Data
      • Laravel Octane
    • 2.2Errors
      • Adding Custom Context
      • Customising Error Grouping
      • Handling Errors
      • Linking To Errors
      • Reporting Errors
      • Sending Logs To Flare
    • 2.3Performance
      • Introduction
      • Sampling
      • Limits
      • Modify Spans And Span Events
    • 2.4Data 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
    • 2.5Older Packages
      • Laravel Flare V1
      • Ignition

    3PHP

    • 3.1General
      • Introduction
      • Installation
      • Censoring Collected Data
      • Ignoring Collected Data
    • 3.2Errors
      • Adding Custom Context
      • Customising Error Grouping
      • Handling Errors
      • Linking To Errors
      • Reporting Errors
    • 3.3Performance
      • Introduction
      • Sampling
      • Limits
      • Modify Spans And Events
    • 3.4Data 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
    • 3.5Older Packages
      • Flare Client PHP V1

    4JavaScript

    • 4.1General
      • Installation
      • Framework integrations
      • Resolving Bundled Code
    • 4.2Errors
      • Reporting errors
      • Client hooks
    • 4.3Data Collection
      • Adding custom context
      • Adding glows
      • Solution Providers

    Adding custom context

    When you send an error to Flare within a non-Laravel application, we do not collect your application information - since we don't know about your specific application. In order to provide more information, you can add custom context to your application that will be sent along with every exception that happens in your application. This can be very useful if you want to provide key-value related information that furthermore helps you to debug a possible exception.

    The Flare client allows you to set custom context items like this:

    // Get access to your registered Flare client instance
    $flare->context('Tenant', 'My-Tenant-Identifier');
    

    This could for example be set automatically in a Laravel service provider or an event. So the next time an exception happens, this value will be sent along to Flare and you can find it on the "Context" tab.

    Grouping multiple context items

    Sometimes you may want to group your context items by a key that you provide to have an easier visual differentiation when you look at your custom context items.

    The Flare client allows you to also provide your own custom context groups like this:

    // Get access to your registered Flare client instance
    $flare->group('Custom information', [
        'key' => 'value',
        'another key' => 'another value',
    ]);
    
    Next topic

    On this page

    • Grouping multiple context items
    Reduce your resolution time by tracking all your PHP and JavaScript exceptions using the most advanced Laravel Error Tracker out there.

    Product

    • Home
    • Features
    • Pricing
    • Support

    Resources

    • Blog
    • Changelog
    • Docs
    • Affiliate program
    • Ignition

    Platform

    • Log in
    • Start a free trial

    Social

    • X ↗


    • Service status
    • Terms of use
    • DPA
    • Privacy & cookie policy