Views
Flare can collect information about the views being rendered in your application. This includes:
- The view name
- The view path
- The view loop (if running within a loop)
We do not collect other view data by default because payloads can be large.
This functionality is enabled by default, but you can disable it by ignoring the Views collect in config.php:
use Spatie\FlareClient\Enums\CollectType;
'collects' => FlareConfig::defaultCollects(
ignore: [CollectType::Views],
),
You can configure the maximum number of views tracked while collecting data in the case of an error as such:
'collects' => FlareConfig::defaultCollects(
extra: [
CollectType::Views->value => [
'max_items_with_errors' => 10,
],
]
),
Manually recording views
If you're rendering views through a templating engine other than Blade, you can record them manually. The PHP documentation provides a full overview of all available recorder methods. When using these methods in Laravel, use the Flare facade instead of $flare:
use Spatie\LaravelFlare\Facades\Flare;
Flare::view()->recordRendering(
name: 'my-view',
data: ['name' => 'Spatie'],
file: '/path/to/view.php',
);
// ... render the view
Flare::view()->recordRendered();
- On this page
- Manually recording views