Integrating Composer command line tool with PhpStorm

Built-in Command Line Tool support plugin provides autocompletion and documentation for any command line based tools. It needs just an xml commands description to support new tool. We plan to add automatic recognition of composer and other popular tools in future, but you can have it working today.

To get Composer dependency manager support in PhpStorm you need to open Settings | Command Line Tool Support and add custom configuration:

Set up alias you’d like to invoke and <php path> <composer path> in Tool Path, and then apply changes.

Then open xml description in editor by pressing and close settings. Copy and paste content of <framework> element from here. Or copy whole description, but then check alias and tool path of Composer in Settings. Voila!

I’m replying to my previous post. Command line tool in PhpStorm seems to be handling any command and running it in the app main directory, so in my case I can just enter bin/command and have it running.

It’s built-in. Maybe the phrase “Framework” confuses – you can execute any command line you want, describe it and attach parameters, you just need to edit the XML file. And automatic recognition is planned as written in this blog post.

Must say, would like to see this as built-in supported framework instead, that may read the appropiate values from help commandName and such.

Anyway

- If you use Linux you can omit the $PhpExecutable$-variable, because the composer.phar contains a shebang-line and is therefore directly invokable.
- If you use Linux, renamed composer.phar to composer and place it somewhere in $PATH you _must_ set a different alias, because otherwise the CLI-console use always composer found in $PATH.
- You can append the CLI-option --ansi to make it look pretty by default

Thank you for useful answer.
- On Linux you can change Tool path from Settings to simply composer.phar.
- Plugin first tries to resolve alias, so it would be changed to the tool path anyway.
- It can be done adding ‘-ansi’ to every command name, i.e. replacing ” to ‘ -ansi’

It shouldn’t be “instead”. It’s built-in support for command line tools, as described by XML files. You can make phpStorm recognize any command line tool by editing a simple XML. And like mentioned in this blog post, future versions will automatically recognize popular tools. It already supports “Zend Framework” and “Symfony” command line tools.

This is indeed a great feature PhpStorm has had for a long time. However, I find myself using the “External Tools” much more often, it has great features:
* Appears in main-menu/editor/project views/search results, just right-click! This means you have context-aware macros you can use. (Like $FilePath$ and $SelectedText$ even! That’s freakin’ awesome indeed)
* Has output-aware regular expression filters!
* Has many useful macros
* Can be grouped into sub-menus
* Can synchronize files after execution
* Can set working directory

About “Command Line Tool Support“, a few questions:
1) Is there any schema definition somewhere or documentation for the XML definition file?
2) Please consider renaming “Framework” in pop-ups to “Tool”. One might be confused with the “Framework Integration” feature. And as the name “Command Line Tool Support” suggests, these are tools, not frameworks. Though this can blown into a whole philosophic debate..