DDEV has built-in Blackfire integration.
- Create a Blackfire account. (Free Blackfire accounts are no longer available; see Blackfire pricing.)
- Install the Chrome or Firefox browser plugin.
- From Blackfire’s control panel, get the Server ID, Server Token, Client ID, and Client Token from your Account → Credentials or environment.
- Configure DDEV with the credentials,
ddev config global --web-environment-add="BLACKFIRE_SERVER_ID=<id>,BLACKFIRE_SERVER_TOKEN=<token>,BLACKFIRE_CLIENT_ID=<id>,BLACKFIRE_CLIENT_TOKEN=<token>". It’s easiest to do this globally, but you can do the same thing at the project level usingddev config --web-environment-add. (It may be easier to manually edit the relevant config file,.ddev/config.yamlor~/.ddev/global_config.yaml.) ddev start.ddev blackfire onto enable,ddev blackfire offto disable,ddev blackfire statusto see status.- With Blackfire enabled, you can use the browser extension.
The Blackfire CLI is built into the web container, so you don’t need to install it yourself.
-
Add the
BLACKFIRE_SERVER_ID,BLACKFIRE_SERVER_TOKEN,BLACKFIRE_CLIENT_ID, andBLACKFIRE_CLIENT_TOKENenvironment variables to~/.ddev/global_config.yamlvia theweb_environmentkey:web_environment: - OTHER_ENV=something - BLACKFIRE_SERVER_ID=dde5f66d-xxxxxx - BLACKFIRE_SERVER_TOKEN=09b0ec-xxxxx - BLACKFIRE_CLIENT_ID=f5e88b7e-xxxxx - BLACKFIRE_CLIENT_TOKEN=00cee15-xxxxx1
You can also do this with
ddev config global --web-environment-add="BLACKFIRE_SERVER_ID=<id>,BLACKFIRE_SERVER_TOKEN=<token>,BLACKFIRE_CLIENT_ID=<id>,BLACKFIRE_CLIENT_TOKEN=<token>", but any existing environment variables will be deleted. -
ddev blackfire on. -
Click the “Blackfire” browser extension to profile.
ddev blackfire onandddev blackfire offddev exec blackfire curl https://<yoursite>.ddev.siteddev exec blackfire drush stddev exec blackfire curl https://<yoursite>.ddev.siteddev sshand use the Blackfire CLI as described in Profiling HTTP Requests with the CLI.