First impressions of Laravel

Published: Jul 1, 2015 by C.S. Rhymes

A friend of mine has recently introduced me to the Laravel php framework, and I have to say I am very impressed! I have been developing with php for a few years now, but it has mostly been building on top of what others have already built and I hadn’t really started my own project from scratch. This time, I thought I would use Laravel for my new project.

Getting started with Laravel

Getting started

The Laravel website contains some great documentation explaining how to get started with Laravel. It explains how to create a new project using the Laravel framework. There are two main ways to start, either by installing the Laravel command line tools (through composer), or by using composer directly. I decided to use composer directly by running the below.

composer create-project laravel/laravel --prefer-dist

This then downloads all of the relevant directories, files and dependancies for Laravel. You then need to change a few directory permissions and you are ready to go.


If you are new to composer, or maybe you are not sure about how to install all the services you need for a web server, then Laravel has another tool to help you get started called Homestead. Homestead is a box, or virtual machine, for Vagrant. Vagrant is a great tool that allows you to bring up, provision and bring down virtual machines that you can use to develop with.

Homestead has everything you need to start using Laravel already installed.

The Basics

So once you have your development environment setup, you can start with the basics. Laravel begins with routing. Routing basically dictates where to go when you visit a page. The routing is incredibly powerful and much easier to use than other traditional methods such as rewrite rules, from the simplest route, such as returning some data directly to the browser, to a function within a container.

Laravel utilises MVC (model, view, controller) and is great to use because of it. When you start using it you may start thinking, where do I put this bit of code and that bit of code, but forcing yourself to use MVC gets you into good habits. The controller tells the model what data it needs, the model goes and gets the data and then it is returned to the view to display it back to the end user. I’m sure I’ve over simplified this, but hey, that’s the way it makes sense to me.

I started off making a simple form, with the html in the view, the validation logic in the controller and the model to communicate with the database. From this alone, I quickly realised the benefits of Laravel as it does a lot of things for you, such as ensuring the data is database safe and exception handling if something doesn’t go as expected. The syntax you use is very nice and seems quite a natural language, although there is quite a lot of initial learning it seems quite quick to pick up.

Laravel makes use of the blade templating engine which makes writing your views even easier. If your controller returns some data to your view, you can reference it by putting it in double curly braces.


After mentioning data, it is worth highlighting another great aspect of Laravel, which is migrations. Traditionally, I would have logged in to my database using a GUI and then started creating tables and manually adding fields into the table. Migrations allow you to write simple code to create and edit tables in your database. Even better than that, it also provides version control.

Simply create a new migration and then write the actions you want to perform in it and then run the migration. This will add the changes, such as a new field, to the database table, but it also allows you to revert the migration and undo your last change. Another benefit of this system is that you can use migrations on another server to synchronise the structure of the database on that server with your server.


One of the other features I have recently discovered is elixir. This is a service that provides an api to run gulp tasks. This allows you to process your files, such as javascript, sass, less and css, and output processed, combined and minified files ready for use.

The feature that stood out to me was the versioning function. This automatically creates a version number for each of the files you specify to ensure that users of your site will always be using the most up to date version of the file and not a cached file.

So many other features

There are so many other features available that all I can say is go and start reading the documentation yourself to find out what it can offer you. I’m pretty sure it will make your life easier.

Another thing to be aware of is the site that offers great tutorial videos. This is a subscription site but it is well worth the investment and has videos on almost every subject I’ve needed help on.

Any other tips?

One thing I would mention is that there seems to be quite a few differences between major releases, such as 4 and 5. From initial experience of the two, I would definitely start with the newest version and learn that as there are even more features built into the newest releases.

Just make sure which version of the documentation you are reading as sometimes Google searches will take you to an older version of the documentation.

If you need help, then ask. There seems to be a great Laravel community online willing to help each other out. Just make sure you offer help back to other newcomers when you become a seasoned pro!


Latest Posts

Building a directory system API in Laravel
Building a directory system API in Laravel

Sometimes it’s difficult to know whether to buy a system, use an existing open source system, or even build your own system. Each approach has its own risks and rewards. As a developer sometimes you get the opportunity to try things out and build a prototype to see what is possible. I recently got this chance and built a prototype for an API.

Using PHP Enums in Laravel to store additional information
Using PHP Enums in Laravel to store additional information

Sometimes it’s difficult to decide where to put code, trying to figure out where it really belongs. Laravel has a predefined folder structure that you can keep to for most scenarios, but I wasn’t sure whether the settings should be kept in a config file, a class, or somewhere else. In the end I decided to use an enum.

Upgrading a Laravel Vapor app to PHP 8.2
Upgrading a Laravel Vapor app to PHP 8.2

I recently updated a Laravel app running on Laravel Vapor to PHP 8.2. I was a bit nervous about the upgrade but it went smoothly for me. This article goes through the steps I went through to upgrade, from local development environment, dependencies, testing and deployment to vapor.

How NOT to make a website

How NOT to make a Website

By C.S. Rhymes

From £8.99

Nigel's Intranet Adventure

Nigel's Intranet Adventure

By C.S. Rhymes

From £2.69