Skip to main content

Convert the Atom Editor into a PHP IDE using PHP Integrator

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.
  1. Upgrade to the latest version of Atom (1.21.1).
  2. Install the package php-integrator-base (3.1.0). (File > Settings > Install)
  3. 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)
       
  4. 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:
    1. 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.)
    2. (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.
    3. Add the php folder to the system's PATH environment variable. Test this by opening a new Command Prompt and typing php -v.
    4. In the php folder, create a new text file called php.ini and copy the contents from the bottom of this guide. Save it.
    5. Test that the extensions are loading by typing php -a at the Command Prompt. If you didn't get any errors, you're good.
       
  5. 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.
    1. First, the Composer Installer will install Composer.
    2. Then, Composer will install around 34 packages.
       
  6. Once done, open your PHP project as a "folder" in Atom (it should appear as a tree on the left pane).
  7. Click Packages > Project Manager > Save Project. Give it a good name and click Save.
  8. 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.

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

Popular posts from this blog

Disable auto save in JetBrains IDE software (IntelliJ IDEA, PyCharm, PhpStorm)

JetBrains provides the following IDE software:
IntelliJ IDEAPhpStormPyCharmRubyMineWebStormAppCodeCLion Google also provides Android Studio which is powered by the IntelliJ platform.

If you come from a different IDE such as Eclipse, you will be unpleasantly surprised to find that JetBrains-branded IDEs automatically save everything the moment you look away. The proponents argue that as you work on your project, you should not have to worry about saving files. But to others, this auto-save behavior which is enabled by default is a curse that catches them by surprise, and a shocking departure from the workflow they are very much used to.

You can change the behavior by altering some settings.

Stop having to click Unblock on every downloaded file

CAUTION: The blocking of downloaded files in Windows is a security and safety feature to help prevent your computer from being infected by viruses and other malware. Only disable this feature if you know what you're doing.

I had been plagued by this annoyance since the days of Windows Vista. Any downloaded file, no matter what browser I use, gets tagged as "blocked" by Windows. You can open downloaded documents even though they are blocked, but when you run a downloaded application (such as a setup file) you're presented with a "Security Warning" before you're allowed to run it. It's worse if you extract a downloaded ZIP file with the Windows' built-in ZIP management. Every extracted file is blocked by default.

Being a geek who finds unnecessary "security" prompts annoying, the first thing I do in Windows is to disable the User Account Control (UAC). But I couldn't quite figure out how to disable blocking of downloaded files until …

Setting up a local Oracle XE database and importing DMP file

The experience of setting up a local Oracle Express Edition database is not a straight-forward as it should be. The following is supposed to outline what could go wrong and how to go about it the right way. It also includes importing a DMP file (a dump) from another system.
First of all, download the installer from Oracle website. You will need to sign-in to download - the account creation is free. Be sure to choose the correct bit as per your computer (x64 or x86).Extract the download and install XE by running DISK1\setup.exe (and feel nostalgic of the floppy disk era). During installation, you will need to choose a new password. There will also be some details displayed after you enter the new password, such as folders and ports.Be sure to save both password and details in a text file for future reference.I saved it as C:\oraclexe\details.txt.Save password only if it's generic and you are likely to forget. The installation will take a while, but usually, no restart is necessary.O…