Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PhpStorm: How to add method stubs from a PECL library that PhpStorm doesn't currently support?

Tags:

php

phpstorm

PhpStorm has a list of method stubs from various compile-time libraries here that it will use for autocompletion in development.

I currently have a list of stubs for the PHP AMQP PECL extension here that I would like to add to my PhpStorm build to get autocompletion for that library.

Is there any way to do this?

like image 659
jcroll Avatar asked May 19 '15 14:05

jcroll


2 Answers

Just place such stub file(s) anywhere in your project (or reference in any other supported way, e.g. as Settings | Languages & Frameworks | PHP | Include path) -- IDE will use it for code completion (and similar) purposes only (so you can exclude them from uploading/VCS etc).

In long term -- you may submit the PR to the already mentioned PhpStorm stubs repository and it may become part of the standard PhpStorm distribution on next release.

like image 140
LazyOne Avatar answered Oct 04 '22 00:10

LazyOne


January 2017 Update: You can git clone (checkout) the PhpStorm stubs repository to your local machine, and point PhpStorm to that directory. From there you can add stubs or even modify/delete existing stubs.

  1. git clone https://github.com/JetBrains/phpstorm-stubs
  2. Open Preferences -> Languages & Frameworks -> PHP
  3. Click Advanced Settings at the bottom
  4. Next to Default stubs path, click the ... and navigate to the root of your phpstorm-stubs folder
like image 29
Michael Butler Avatar answered Oct 03 '22 23:10

Michael Butler