Laravel Basics 5 lessons
  1. 1 What a framework gives you
  2. 2 Routes, controllers and views sign in to open
  3. 3 Eloquent and the database sign in to open
  4. 4 Validation, authentication and forms sign in to open
  5. 5 Getting it onto a server sign in to open
Course overview
Data: video · change

This lesson: 122KB

Laravel Basics · Lesson 1 of 5

What a framework gives you

See what Laravel removes from your day.

PHP written without a framework works. What it does not do is stay organised once there are more than about twenty files and more than one person.

Laravel gives you four things that matter immediately.

A place for everything. Routes here, controllers there, models over here, views in one folder. That sounds like bureaucracy until you open somebody else's Laravel project and find your way around in five minutes, which is the actual benefit.

Security by default. Escaped output in templates, so a comment containing a script tag is displayed rather than executed. Prepared statements, so a form field cannot become SQL. A CSRF token on every form. Every one of these is a hole that hand written PHP has to remember to close every single time.

Batteries included. Authentication, validation, database migrations, queues, scheduled tasks, mail, file storage. These exist in every project, and writing them yourself means writing them slightly wrong.

Migrations and seeds, which mean your database schema lives in version control alongside the code instead of in somebody's memory and a backup file.

The cost is that you learn the framework's conventions, and there are many. The payoff is that those conventions are shared: a Laravel developer in Karachi can join your project and be useful the same week.

Install with Composer. Use the current version. Learn PHP properly alongside, because a developer who only knows the framework is lost the moment something behaves unexpectedly.

Lab — try it yourself

Create a new Laravel project and read the folder structure. Write one line for each top level folder saying what belongs in it.

Check what you learned

Create your free BvLogic ID to take the quiz and record your score.

Create your BvLogic ID
Continue to lesson 2 Up next 2. Routes, controllers and views