Laravel 5.1 development with the Atom editor
Tuesday, June 30th, 2015The brand new Atom editor is heavily inspired by Sublime, build as an open source project on webtechnology, so CSS, JavaScript and HTML, Coffeescript, LESS and NodeJS, it’s founded by Github and really hackable into the next generation.
It sports a package installer, and a nice repository full of plugins, more then 2100 at the moment.
It just released version 1.0, for Linux, Windows and OS-X. Atom is free and open source.
In short I like it. It has good support for syntax-highlighting, code-completion and snippets. A code beautifier is available as package, and so is Emmet. Atom is more an editor than a full-blown IDE, like Netbeans, but packages are really easy to build, so I guess, a lot of extending is possible.
For Laravel you need some tweaks.
Improve Laravel support in Atom
Install some extra Laravel related packages:
- language-blade
- atom-laravel
There are more packages like blade-snippets, but actually you don’t need them. Snippets are include in the language-blade package, although the documentation lacks to mention that. The documentation just says:
Blade templating support in Atom
Actually it adds snippets too.
Make Atom act as a IDE
A great feature of Atom is the build in Tree View. Open a projectfolder, and Atom will show you a nice tree folder view.
But to browse through your files, use another feature. Atom will index all files. CTRL P will open an findAll dialog, or a fuzzy finder and that is the fastest way to change and find files in your project. Much like Sublime or Netbeans, or CTRLP plugin for VIM.
Another IDE feature Goto Declaration doesn’t seem to work. And that is true, it doesn’t work out of the box. That did confuse me and apparently others. It needs a CTAG file. CTAG files are created by another program Exuberant Ctags. Atom’s approach is much like the Unix philosophy. Don’t invent the wheel, or
- Small is beautiful.
- Make each program do one thing well.
Exuberant Ctags does something well, so don’t imitate it. Use it.
How to install Exuberant Ctags for Atom support
sudo apt-get install exuberant-ctags
Then CD into your working directory, the root of your project:
cd ~/project
Then run CTAGS to create the TAGS file:
ctags -R --languages=php
That’s it. Goto Declaration will now work on Laravel helper functions and classes.
Great. Netbeans lacks support for Laravel, and especially editing blade files is much easier in Atom with the language-blade package.
Atom isn’t the fastest editor, it’s isn’t optimized yet that much according to the developers, and it is build upon web technologies. That means it’s hackable and extendible for nearly everyone. For that it already got a sweet spot here and no doubt the community will build every package you can think of. It´s so easy and well integrated with Github. Bright future.