Autocompletion for custom PHP classes in Sublime Text 2/3
Solution 1
Highly recommend checking out Matt Stauffer's post on using Sublime Text 3 for PHP development.
https://mattstauffer.co/blog/sublime-text-3-for-php-developers
I am using SublimeCodeIntel. The trick for me was to ensure that the php interpreter was referenced correctly. Go to Sublime Text Preferences > Package Settings > SublimeCodeIntel > Settings - Default
. Check that the language setting for php references the correct location for your php command, which you can find with which php
in Terminal.
"codeintel_language_settings": {
...
"PHP": {
"php": "/usr/bin/php",
"codeintel_scan_extra_dir": [],
"codeintel_scan_files_in_project": true,
"codeintel_max_recursive_dir_depth": 15,
"codeintel_scan_exclude_dir":["/usr/bin/php/"]
}
}
If that block is wrong, copy to SublimCodeIntel user settings and modify as needed.
Solution 2
You can try PHPintel
Install PHPintel using Package Control
Create or open a project with PHP files
Run the command PHPIntel: Scan Project command from the command palette
After the initial scan, PHP files will be automatically re-scanned whenever you save them.
https://github.com/jotson/SublimePHPIntel
Related videos on Youtube
Иван Светушков
Know some code here and there. Python, PHP, MySQL, Lua, Java, HTML, CSS, Javascript.
Updated on September 18, 2022Comments
-
Иван Светушков over 1 year
How can I get autocomplete in Sublime Text 2 (or 3) to work with built-in and custom PHP functions, methods and classes?
In Atom I've got it working with built-in functions, like this:
In Sublime it lists built-in functions and some custom classes (after awhile) but without any arguments. Nothing else works.
Packages I've tried:
-
Иван Светушков over 8 yearsThanks, it seems like it suggests all available classes now. Though it still doesn't show the arguments for the constructor or the methods.
-
MrBuBBLs about 7 yearsSorry but that package didn't work for me and it also has the really annoying process of adding a '.phpintel' folder under each folder opened in the project. Finally, as I write this, that extension is dead (no update since may '16).