- Sep 26, 2013
- 0
- by A2 Dev Team
If you’re developing in Ruby you probably are going to use Ruby on Rails. If you’re doing server side JavaScript, you’re probably going to use Node.js. But if you’re writing PHP, there’s no shortage of frameworks to choose from. Each of them offers different advantages, and if you don’t already have a favorite, picking one can be a daunting task. At A2 Hosting we’re fans of Laravel, and that’s why we’ve become the Laravel Hosting sponsor. Laravel brings a lot of wonderful features together in one framework, so many that I can’t go into all of them here, but I’ll touch on a couple. Of course, Laravel is built around a now standard MVC (Model, View, Controller) application style, and I won’t go into that here.
Laravel makes developing a RESTful application easy with Routing. Routing provides you a clean, easy way to specify application flow based on the request you’ve received. No big nasty switches, no endless series of PHP scripts which are called individually and each contain their own pages long switch. You have clean Routing which can be broken up into files as it best makes sense for your application design. The implementation is simple and elegant, and facilitates a clean RESTful design.
Most experienced PHP developers have stopped including HTML in line with their PHP code. We break it off into templates, and keep just PHP in our PHP scripts. Right? Oh wait, no, most of them are also full of tons of SQL statements. Where other languages have nice, fluent database interfaces, most PHP developers are stuck writing their SQL in line with their PHP. Sure we might be using PDO objects, but we’re still often having to write large chunks of application logic in SQL. Which, let’s face it, is not ideal. Laravel provides Eloquent, which is a fluent database interface reminiscent of Ruby on Rails’ Active Record. It provides you a way of dealing with your database in PHP. Easier to read, easier to write, since you don’t have to shift gears constantly when writing your model code.
Ruby Gems come with their own headaches, but the reality is that having a package management tool like Gems for Ruby or NPM (Node Package Manager) for Node.js makes working in that language a lot easier. Laravel has adopted the popular and powerful Composer package manager for PHP. And in fact the entire Framework is available as a set of modular Composer packages. Packagist.org lists more than 16,000 Composer packages avaialble. Quantity does not equal quality, but having that kind of library available at your fingertips is incredibly powerful.
Laravel has a lot more to it, and I highly recommend checking out the Quick Start Guide for a bit more detail than I’ve gone into here. It’s making writing in PHP fun again for a lot of jaded developers who were otherwise ready to move on.