Atom Editor is basically a text editor on steroids. It is not an IDE for any language by default. Through the power of plugins, you can convert Atom into almost anything you wish, except a toaster.
Here I am documenting what I did in order to convert Atom Editor to a nice PHP IDE. You can do the same too using PHP Integrator and make it much easier to maintain your PHP projects in Atom.
Note: Throughout the guide, I'll indicate version numbers at the time of writing in brackets. This is only for reference, and you must always install the latest version of the software, not the version indicated here.
Here I am documenting what I did in order to convert Atom Editor to a nice PHP IDE. You can do the same too using PHP Integrator and make it much easier to maintain your PHP projects in Atom.
Note: Throughout the guide, I'll indicate version numbers at the time of writing in brackets. This is only for reference, and you must always install the latest version of the software, not the version indicated here.
- Upgrade to the latest version of Atom (1.21.1).
- Install the package php-integrator-base (3.1.0). (File > Settings > Install)
- Atom will ask you to install dependencies. Say Yes. The dependencies are (at the moment):
- atom-ide-ui (0.5.3) (previous versions used linter, but you should disable/remove that now as it will conflict with Diagnostics)
- intentions (1.1.5)
- project-manager (3.3.5)
- Download and install PHP 7.1 or above (if you don't have it already). I'm on Windows so I got the x64 NTS build (7.1.11). OS-specific instructions:
- Extract the downloaded ZIP into a folder of its own (Do not extract to your working folder, as the archive has all files at its root.)
- (Optional) Move and/or rename the folder to a convenient location like C:\Program Files\php or C:\php. You should see php.exe and other files upon opening the folder, like C:\Program Files\php\php.exe.
- Add the php folder to the system's PATH environment variable. Test this by opening a new Command Prompt and typing php -v.
- In the php folder, create a new text file called php.ini and copy the contents from the bottom of this guide. Save it.
- Test that the extensions are loading by typing php -a at the Command Prompt. If you didn't get any errors, you're good.
- Restart Atom. The PHP Integrator plugin will start downloading its core. Fair warning: This needs some time and downloads about 144 MB of data. You can monitor the progress in the Console of Developer Tools.
- First, the Composer Installer will install Composer.
- Then, Composer will install around 34 packages.
- Once done, open your PHP project as a "folder" in Atom (it should appear as a tree on the left pane).
- Click Packages > Project Manager > Save Project. Give it a good name and click Save.
- Click Packages > PHP Integrator > Set Up Current Project. PHP Integrator will start indexing your PHP project. It should be quick.
Once the indexing is done, open any PHP file in the project and try some things like:
- Type a standard PHP function or method name to its full documentation as a tip.
- Hold Ctrl and click a custom function call to jump to its definition.
- Put the cursor on a function name and press Alt-Enter (or maybe Ctrl-Enter) to get the intentions menu. Select "Show Documentation".
- Open the Diagnostics panel by clicking the (Error)(Warning) counts on the left side of the status bar.
- Have fun!
I recommend installing the package php-integrator-autocomplete-plus (1.6.1) and other php-integrator-* NON-legacy additional packages to suit your needs, but PHP Integrator project has plans to merge these packages into the base. So do check whether the merge has been done. The package's readme file should tell you which supplementary packages are still separate from the base.
Tip: You can improve your PHP project to work better with PHP Integrator. Take a look at type hinting and docblock formatting here. Refactoring your project by these guidelines will give PHP Integrator the ability to suggest the correct types and documentation for your project's own code.
Tip: You can improve your PHP project to work better with PHP Integrator. Take a look at type hinting and docblock formatting here. Refactoring your project by these guidelines will give PHP Integrator the ability to suggest the correct types and documentation for your project's own code.
PS: Send the package creator some coffee beans. (Disclaimer: This won't send me any beans.)
php.ini file:
[PHP]
extension_dir = "ext"
extension=php_mbstring.dll
extension=php_openssl.dll
extension=php_pdo_sqlite.dll
(blank line at the end of file)
Comments
Post a Comment
Comments are moderated, and are usually posted within 24 hours if approved. You must have a minimum of OpenID to post comments.