- Sep 26, 2013
- by Dave Matteson
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.