blackfire
Profile PHP applications performance
TLDR
Initialize and configure the Blackfire client
Launch the Blackfire agent
Launch the Blackfire agent on a specific socket
Run the profiler on a specific program
Run the profiler and collect 10 samples
Run the profiler and output results as JSON
Upload a profiler file to the Blackfire web service
View the status of profiles on the Blackfire web service
SYNOPSIS
blackfire [options] <command> [<args>]
PARAMETERS
-q, --quiet
Do not output any message
-V, --version
Display application version
--ansi
Force ANSI output
--no-ansi
Disable ANSI output
-n, --no-interaction
Do not ask interactive questions
-v|-vv|-vvv, --verbose
Increase verbosity (1=normal, 2=verbose, 3=debug)
--config FILE
Path to configuration file
--socket SOCKET
Path to agent socket
DESCRIPTION
Blackfire is a powerful performance analysis tool for PHP applications, enabling developers to profile code in development, staging, and production environments with negligible overhead. The blackfire command-line interface serves as the primary entry point for managing the Blackfire agent, executing profiles, configuring settings, and generating reports.
It excels at identifying bottlenecks in CPU usage, memory allocation, I/O operations, database queries, and external calls. Using a patented probing technology, it instruments PHP code dynamically without requiring code changes. Key features include wall-time profiling, call graphs, flame graphs, and recommendations for optimizations.
The CLI supports subcommands like agent for starting the server-side agent, curl for profiling HTTP requests, php and exec for scripting, and status for diagnostics. It integrates seamlessly with Blackfire.io for online dashboards, alerts, and continuous monitoring. Requires a free Blackfire account for full features, with client/server IDs for authentication.
Ideal for Symfony, Laravel, and custom PHP apps, it provides actionable insights beyond traditional tools like Xdebug.
CAVEATS
Requires Blackfire account credentials; PHP extension or agent must be installed separately. Minimal overhead but not zero; production use needs caution. Linux/macOS/Windows supported, but agent socket paths vary.
COMMON SUBCOMMANDS
agent: Manage profiling agent.
curl URL: Profile HTTP requests.
php script.php: Profile PHP scripts.
status: Check components.
INSTALLATION
curl -s https://packagecloud.io/install/repositories/blackfireio/blackfire/script.deb.sh | sudo bash
sudo apt-get install blackfire/blackfire-agent blackfire
HISTORY
Developed by SensioLabs (creators of Symfony) around 2013; acquired by Blackfire.io. CLI evolved with Symfony Console framework. Major versions align with PHP 5.3+ support, now PHP 8.x compatible.


