Blackfire is a PHP profiler that helps you analyse the performance of your code. It's a paid service, but you can get a free trial at blackfire.io.
We only support PHP 8.1+ for Blackfire. The extension is disabled by default.
Blackfire is an optional service and is not installed or enabled by default. To enable it, add the blackfire.yml file to your COMPOSE_FILE list in the .env file and fill in the Blackfire environment variables. For example, on Unix systems:
COMPOSE_FILE=docker-compose.yml:opt/blackfire.ymlAfter updating the .env file, run docker compose up -d --remove-orphans to start the service.
Blackfire works by profiling your code as it runs.
A PHP extension must be installed into your PHP container. While the code is running, the PHP extension sends the profiling data to the (local) Blackfire agent container. The agent container processes the data and uploads it to the Blackfire.io website (where you can view the results).
- Edit your
.envfile- Fill in all Blackfire environment variables
- Enable the agent container by adding
opt/blackfire.ymlto theCOMPOSE_FILElist
- Enable the Blackfire extension for PHP:
# Choose the PHP version you want
devin 85
debug --enable blackfire
exit
docker-compose restart
Similar to above. Simply run "debug --disable-all":
# Choose the PHP version you want
devin 85
debug --disable-all
exit
docker-compose restart
Make sure you've enabled the Blackfire extension for PHP as per the instructions above. You can confirm it's enabled by using phpinfo() in your browser.
- Sign into blackfire.io
- Install the Blackfire extension in your browser. Here's one for Google Chrome
- Navigate to the site/page you'd like to profile
- Click the 'Profile' button in the Blackfire browser extension
- Check the Blackfire extension is installed in your PHP container. Use
phpinfo()to confirm. - Check the Blackfire agent (container) is running. Use
docker compose psto confirm. - Check your Blackfire environment variables are correct in
.env.
The Blackfire documentation should have the answers you are looking for.