Per-Project PHP Extension Settings in PhpStorm 2017.1

Code completion in PhpStorm is one of the most important and most used features that the IDE has, and PhpStorm 2017.1 comes with new settings that help completion be more relevant, and faster.

Some of the best features that make it into PhpStorm come from suggestions from our amazing users, and this feature is no different. Why should you have code completion suggestions for extensions that aren’t even installed in your version of PHP? You shouldn’t, and PhpStorm 2017.1 allows you to disable completion for extensions you don’t use.

You can find a list of extensions to enable or disable by going to Languages & Frameworks | PHP | PHP Runtime:

php-runtime

We understand this isn’t ideal, and wanted to share with you our plans for this feature in the future. Because PhpStorm knows exactly which PHP interpreter you are developing against, in future releases we hope to auto-detect the extensions that are available in the IDE from those that are installed for PHP. This means that you will only have completion on the extensions you are using in your project, making completion more useful, and quicker.

We are also hoping to add new functionality to PhpStorm to detect when you have not enabled extensions in PhpStorm but are using them in your code. This should make it easier to enable those extensions you are using but have not told PhpStorm.

In the future, this could be extended to detect when you are trying to use functions from extensions you don’t have installed for PHP. It would be very useful to find out at coding time that you are using an extension you don’t have installed, rather than having to run your code and understand the error.

The upshot of these improvements will be that we can accept stubs (the annotated code that PhpStorm uses to fire completion in the IDE) from more third-party extension developers, as we can disable them when not installed. The big problem with including more and more stubs in PhpStorm has always been the trade-off between functionality and speed – the more stubs we include, the more complete your experience, but the slower the IDE becomes. We’re hoping to turn lots of extensions by default as soon as 2017.2, and we’re already accepting more stubs in preparation.

Thanks for continuing to support PhpStorm. Hopefully, the improvements in PhpStorm 2017.1 and the coming improvements in future versions will make your development experience faster and more effective!

– Gary & The PhpStorm Team

About Gary Hockin

Gary Hockin has been creating code to power web applications for 15 years, the last three of them at an extraordinary level. He is handsome, talented, funny and articulate, and also extremely modest. Gary is a valued contributor to Zend Framework 2 and is a member of the community review team. He's married and has two wonderful children, and when he's not coding, writing about code, speaking about code or reading about code, he can usually be found in the pub playing pool.
This entry was posted in Cool Feature, Newsletter. Bookmark the permalink.
  • mcfedr

    A really great way to detect the extensions I’m using would be via the composer.json file.
    Also if I used a function from an extension that isn’t in the composer file you could suggest I add it.

  • http://mnapoli.fr/ mnapoli

    > Because PhpStorm knows exactly which PHP interpreter you are developing against, in future releases we hope to auto-detect the extensions that are available in the IDE from those that are installed for PHP.

    Awesome!