PHP Integrator is a free and open source server that provides IDE-like features for PHP projects to clients. It can be integrated into any editor and is currently integrated into the the Atom editor via a set of packages.
One of the most useful features in a programmer's toolbox is autocompletion, which suggests:
- Relevant object class members
- Global functions and constants
- Local variables
Code Navigation / Goto Definition
Code navigation allows you to effortlessly travel through your codebase by clicking the names of method calls, classes, interfaces, and other structural elements.
Navigating will immediately take you to the relevant location in your code base.
Annotations provide you with relevant information about your code, such as that a parent property is being overridden or an interface method is being implemented.
As an added bonus, clicking them will take you to the related element, whenever possible.
Tooltips display documentation for structural elements. Think extended docblock descriptions, method parameter descriptions, return type descriptions and exceptions thrown.
Refactoring is the component that has the most potential. Features currently include:
- Generating constructors
- Overriding existing methods
- Getter and setter generation
- Stubbing interface methods and abstract methods
Signature Help (Call Tips)
Signature help is much like tooltips, but differs only in that it displays information directly relevant to function or method calls, such as their expected arguments with their types and default values.
The list wouldn't be complete without a way to highlight errors before stumbling upon them whilst running the code. Finding nonexistent class names, docblock issues and missing global functions are all included in this process.
Awesome! What do I need?
To run, you will need at least:
- PHP 7.1 or higher * — The code you're actually writing can be anything ranging from PHP 5.2 up to (and including) PHP 7.1.
- php-sqlite (the PDO variant) and SQLite >= 3.7.11 — Required as back end for the indexing database.
- php-mbstring — Required as source code can contain Unicode characters in strings or comments.
- openssl — Required to fetch dependencies properly via Composer.
- atom-project-manager — Fire up your active project and go to Packages → PHP Integrator → Set Up Current Project (or use the command palette).
- Proper docblocks and type hinting - See our wiki for more information.
The following modules aren't directly used, but they may be required for installation in Atom via Composer or by dependencies:
* Still running PHP 5.6 or PHP 7.0? Look for the Atom packages suffixed with the text -legacy-php56, such as php-integrator-base-legacy-php56. These are unmaintained, but may provide a stopgap until you are able to update.
How do I make it work?
In a nutshell:
- Install PHP 7.1 or higher.
php.ini, enable the extensions mbstring, openssl and sqlite (the PDO variant).
- In Atom editor, install the base package and its dependencies.
- If necessary, give the path to your PHP binary in Settings → Packages → php-integrator-base Settings → Core.
- Restart Atom and allow the base package to install the core.
- Add your project in Project Manager and set it up.
It may also be worthwile to disable xdebug, if you have it enabled, as even loading it can have a negative impact on performance.
Wait, now I'm confused, what is it really?
At the moment, PHP Integrator itself consists of a set of Atom packages written in CoffeeScript, backed by a server written in PHP (the core). The PHP server is separate from the Atom packages and reusable, but is installed automatically to make the process of installing it as painless as possible for Atom users.
Various additional functionalities, such as autocompletion and refactoring, can be installed as separate Atom packages as well. These packages interface with the base package via a CoffeeScript service. Most of the heavy lifting, such as indexing, analyzing types and static analysis is done by the PHP server.
Is it really exclusive to Atom?
The packages and CoffeeScript parts are dependent on Atom, but the PHP server, which does the heavy lifting, is not dependent on Atom at all. The PHP server was originally part of the base Atom package, but has since been split off into a separate repository.
What about making it a language server?
The Language Server Protocol has gathered some interest of late. Currently the core is not a compliant language server, but it already is a socket server using JSON-RPC for communication. Becoming compliant with the protocol is on the roadmap and would make the core much more reusable for other editors.
Where is the code?