03 Mar Laravel
Ever since its first release in 2011, Laravel has taken the web development community by storm. It’s widely used among PHP developers, and each developer have their own reasons. In this post, I’d like to share mine.
What is Laravel?
Laravel is a simple, but robust, PHP framework. But what is a framework? To understand that, we must look at what actually lies under the hood of a website…
The Anatomy of a Website
There are many various components that make up a website. These components settle into two main categories: front-end and back-end.
The front-end of a website is anything you can see. Images, text, forms – all created with hypertext mark-up language, or HTML for short. HTML creates the “skeleton” of the website, but CSS (cascading stylesheets) is what makes the page pretty. With CSS, we can control how certain elements on the page appear on the browser. We can specify things like: text colour, background colour, dimensions, and more. Laravel isn’t a front-end framework, so we won’t go into any extra detail on this, but if you’re interested in this, you can view a full list of CSS properties here.
The back-end of a website is, pretty much, anything that you don’t see. Form processing, authentication, content management. You don’t see these things on the page, but they happen in the background. They’re not easy things to handle either. Most web applications require:
- A database, to… well, store data
- A database wrapper to build and execute queries
- A routing engine for SEO-friendly URLs
- Form validation wrappers to process form data, such as login forms
- A session handler and/or authentication system to handle user sessions
- A caching solution for performance
- An encryption library for storing and validating passwords
- Mailing library to send emails
We haven’t even gotten started on the functionality of the website itself yet.
So again, what is Laravel?
Laravel allows developers to concentrate solely on building the website without having to worry about form validation, data storage, caching, etc. – it is all included in Laravel. Because of this, development can also be sped up drastically — if you utilise the Laravel’s power correctly, that is.
The MVC Architecture
If you’re into the techy side of things, Laravel uses the MVC architecture. MVC stands for:
- Model – The model represents the data in the database, and usually allows CRUD (create, read, update, delete) operations, which essentially means that we can pull and push data, to and from the database.
- View – Simply the HTML markup. More commonly known as “template”.
- Controller – The controller connects the two. For example, if our website had a user list, the user list controller would instantiate the user model and return all users from the database. It would then pass this data into a view, and render it.
All in all, Laravel is great if you’re a PHP developer, and want to speed up your development. Personally, I’ve used it since its fourth release and it’s been great. I’d happily recommend it to other developers.
If you’re interested in having a fiddle with Laravel, take a look at the official installation guide.