A Symfony bundle for integrating Excimetry with your Symfony application.
composer require excimetry/symfony-excimetry
Note: If you're using Symfony Flex (which is the case for most modern Symfony applications), the bundle will be automatically registered in your application's
config/bundles.phpfile. No additional configuration is needed for the bundle registration.
The installation process automatically creates configuration files at config/packages/excimetry.yaml or config/packages/excimetry.php. You can use either format based on your preference. If these files don't exist, you can create them manually:
# config/packages/excimetry.yaml
excimetry:
# Whether the bundle is enabled
enabled: true
# The sampling period in seconds
period: 0.01
# The profiling mode (wall or cpu)
mode: wall
<?php
// config/packages/excimetry.php
return [
'excimetry' => [
// Whether the bundle is enabled
'enabled' => true,
// The sampling period in seconds
'period' => 0.01,
// The profiling mode (wall or cpu)
'mode' => 'wall',
],
];
The bundle provides an ExcimetryService that wraps the Excimetry profiler. You can use it as follows:
You don't need to call ->start() method if you enabled the bundle.
<?php
class Kernel extends BaseKernel
{
...
private ?ExcimetryService $excimetryService;
public function boot(): void
{
if (!$this->booted) {
// Start the profiler before booting the kernel
if ($this->container && $this->container->has(ExcimetryService::class)) {
$this->excimetryService = $this->container->get(ExcimetryService::class);
}
...
}
}
public function terminate(Request $request, Response $response): void
{
if (!is_null($this->excimetryService)) {
$log = $this
->excimetryService
->stop()
->getExcimetry()
->getLog();
$exporter = new PyroscopeBackend(
serverUrl: 'https://pyro:4040',
appName: 'symfony_app',
exporter: new CollapsedExporter()
);
$exporter->send($log);
}
...
}
}
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
How can I help you explore Laravel packages today?