tourze/symfony-command-profile-bundle

0.0.2 2025-04-23 19:56 UTC

This package is auto-updated.

Last update: 2025-04-25 19:17:36 UTC


README

English | 中文

Latest Version Build Status Quality Score Total Downloads

A Symfony bundle that profiles and outputs the runtime of console commands. It helps you analyze the performance of your custom or built-in Symfony console commands by displaying the execution time after each run.

Features

  • Automatically tracks and displays the execution time for every Symfony console command
  • No code modification needed for your commands
  • Lightweight and easy to integrate

Installation

Make sure your project uses Symfony 6.4+ and PHP 8.1+.

Install via Composer:

composer require tourze/symfony-command-profile-bundle

Quick Start

  1. Register the bundle in your Symfony application's config/bundles.php (if Flex does not auto-register):
return [
    // ...
    Tourze\CommandProfileBundle\CommandProfileBundle::class => ['all' => true],
];
  1. Run any Symfony console command:
php bin/console your:command

At the end of the command output, you will see a line like:

RunTime: 0.123456

No additional configuration is required.

Advanced

  • The bundle uses event subscribers to hook into ConsoleEvents::COMMAND and ConsoleEvents::TERMINATE.
  • Uses nesbot/carbon for precise time calculation.

Contributing

Please see CONTRIBUTING.md for details.

License

This bundle is open-sourced software licensed under the MIT license.

Changelog

See CHANGELOG.md for version history and upgrade notes.