PHP IDE like features for Atom setup
Atom is a hackable text editor for the 21st century, built on Electron. Since the release of Atom i’ve had a love hate relationship. The editor itself was looking beautiful with an awesome community of people developing plugins. But on the other hand it was lacking functionality like autocompletion and indexing my project like the IDE PHPStorm. There were some packages available that implemented this functionality but they either performed bad or didn’t work at all. Until now.
Lets setup the editor so we have more IDE like features but still keep it light weight enough to develop quick and smooth.
1. Install the required packages:
We are going to use the package PHP integrator base and this plugin requires some other packages to be installed before.
First we need to install the package Project Manager by Daniel Broding We can do this through the editor function cmd+shift+p and type install package.
This will popup the settings view where we are able to search for packages. Type in the field project manager and hit the install button.
Now that we have the project manager installed we are able to integrate the other package as well. Get back to the package manager install screen cmd+shift+p and type “install package” and search for php-integrator. This will bring up a lot of packages that use the base php-integrator package. So first install the php-integrator-base package and after that its up to you which ones you install.
Here is a list of packages I use in daily development:
- php-integrator-navigation
This package let you navigate through your php project fast like alt-click on a class name for example. - php-integrator-call-tips
This will render a tooltip of helpful information while you call a function or method. - php-integrator-linter
This will check your code for errors. - php-integrator-tooltips
This will show a tooltip with documentation about classes, properties, use statements etc. - php-integrator-autocomplete-plus
This will autocomplete your code with classes, interfaces, method etc. from your codebase.
2. Register your project and start indexing
Now that we have the required packages installed we are able to register the project and start indexing the code. First we need hit cmd+shift+p again and type the following command: “project save”. This will show you an option to save the current state of your file tree as a project. You can give it a name and hit enter.
The project manager now knows about your project and php-integrator uses this to index the files. We need to go back to the command panel (cmd+shift+p) and type “php integrator set up project” and hit enter. You will see the project indexing process in the bottom right of your screen and this shouldn’t take to long to finish.
Thats about it! Your Atom editor is setup for PHP development. Start trying out some stuff like autocomplete and navigating fast through classes and use statements.