Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Symfony Excimetry Laravel Package

excimetry/symfony-excimetry

View on GitHub
Deep Wiki
Context7

ExcimetryBundle

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.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels
wazza/laravel-db-encryption
hokny/laravel-generator
vonsogt/backup
jengo/queues
jeremykenedy/laravel-observability
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums