Meet the new Blackfire CLI tools
Based on your feedback, we’ve worked on a brand new version of the Blackfire CLI tools.
Profiling Web Services or APIs is better done via the CLI. The new version of the CLI tool (version 0.21) comes with some useful improvements.
Note: Check the current version with blackfire version
and follow the instructions from our docs to upgrade.
First, we’ve worked on better error handling. We’ve also improved the error reporting to the user when something goes wrong. And to make the Blackfire experience more consistent, the CLI tool behaves more similarly to the Companion.
But there are more interesting features!
Options Handling
One popular change request was the possibility to use CLI options before or/and after the command; that’s possible in the new version and the following two commands are now equivalent:
blackfire run --slot=10 --samples=10 php -r 'echo "Yep!";' blackfire --slot=10 --samples=10 run php -r 'echo "Yep!";'
The same goes for all sub-commands like curl
and upload
.
Embedded Agent
Currently, the blackfire run
and blackfire upload
commands need a local running agent to be able to operate properly. It is annoying, especially if you just want to upload some Callgrind files.
That constraint has been removed as the Blackfire CLI now comes bundled with its own embedded agent. When calling run
or upload
, Blackfire automatically runs a virtual agent in the background when it needs one; it’s totally transparent and it does not interfere with your own local agent if you have one.
HTTP Proxy Configuration
If you need to use a proxy to connect to the Internet, Blackfire now automatically configures itself by reading the HTTP_PROXY
and HTTPS_PROXY
environment variables.
You can also force the usage of a specific proxy by using the --http-proxy
or --https-proxy
options on any sub-commands.
Happy CLI profiling!