excimetry / symfony-excimetry
Excimetry Bundle for Symfony
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^8.2
- excimetry/excimetry: ^1.0
- symfony/framework-bundle: ^6.4 || ^7.0 || ^8.0
Requires (Dev)
- composer/composer: ^2.0
- phpunit/phpunit: ^11.0
- symfony/phpunit-bridge: ^6.4 || ^7.0 || ^8.0
- symfony/yaml: ^6.4 || ^7.0 || ^8.0
README
A Symfony bundle for integrating Excimetry with your Symfony application.
Requirements
- PHP 8.2 or higher
- Symfony 6.4 or higher
- excimetry/excimetry package
Installation
Step 1: Install the Bundle
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.php
file. No additional configuration is needed for the bundle registration.
Step 2: Configure the Bundle
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:
YAML Configuration (config/packages/excimetry.yaml)
# 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 Configuration (config/packages/excimetry.php)
<?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', ], ];
Usage
Using the ExcimetryService
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); } ... } }
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.