Backend Sviluppo Web REST API

Laravel REST API – Complete Course for Beginners and Developers

Build a complete REST API with Laravel from scratch: routes, controllers, MVC, CRUD with SQLite and all framework best practices.

Course description

Laravel REST API: Build Your First API from Scratch

If you've heard about Laravel but don't know where to start, this is the right course. I'll guide you step by step from the first installation of PHP and Composer to a complete REST API with CRUD operations, database and migrations. No copy-paste: you understand each step, write it yourself and see it working in Postman.

What You'll Learn

  • Install PHP, Composer and create a Laravel project on Windows from scratch
  • Understand the folder structure and how Artisan works
  • Define API routes in api.php and understand how Laravel handles them
  • Apply the MVC pattern (Model-View-Controller) in a real project
  • Create dedicated controllers, route segments, and GET and POST query parameters
  • Build an in-memory API (index + show) then move to a real database
  • Add a POST store with incoming data validation
  • Configure SQLite as a database and use DB Browser to inspect it
  • Write and run migrations (up and down) to version the schema
  • Use the Eloquent Model with fillable for security and simplicity
  • Complete the CRUD: destroy for DELETE and update for PUT
  • Handle REST routes automatically with Resource Controller

From Installation to a Working CRUD — Step by Step

The approach is deliberately linear: first we build everything in memory so we understand the structure, then we introduce the database. Each new concept builds on the previous one. At the end of the course you have a real, testable REST API ready to extend with authentication, relationships and more advanced logic.

Who This Course Is For

Designed for those who know PHP basics but have never used a framework. If you've already worked with Laravel, some sections may be familiar, but the systematic approach helps consolidate the foundations that are often taken for granted.

Lessons list

Let's explore what REST APIs are, why they've become the de facto standard for communication between web and mobile applications, and the path we'll follow in this course starting from zero.

Guarda lezione

I'll show you how to install PHP on Windows step by step: downloading the archive, configuring the PATH environment variable, and verifying from the terminal that the php command works correctly before moving on.

Guarda lezione

Let's continue setting up the development environment: I'll show you how to install Composer on Windows, link it to the PHP executable, and understand its fundamental role in managing Laravel project dependencies.

Guarda lezione

In this lesson we create the first Laravel project using the Composer command from the terminal, explore the auto-generated files and folders, and launch the built-in Artisan development server.

Guarda lezione

Let's walk through the complete folder structure of a Laravel project — app, routes, config, resources, and more — and how to manage all PHP dependencies through the composer.json file.

Guarda lezione

I'll show you how to start the Laravel development server with the Artisan Serve command and introduce API routes, explaining why they aren't active by default in a new installation and how to fix that.

Guarda lezione

In this lesson we fully activate Laravel's API routes: we create the api.php file and use the php artisan install:api command, comparing both approaches and understanding the practical differences.

Guarda lezione

I'll explain how the MVC pattern works when applied to REST APIs in Laravel: the role of the Model and Controller, and the complete flow of an HTTP request from entry point to JSON response.

Guarda lezione

Let's see how to create a Laravel Controller with the Artisan command and connect it to API routes in api.php to handle GET requests in a clean, structured way following the MVC pattern.

Guarda lezione

In this lesson we learn to use dynamic URL segments in Laravel GET routes: how to define them with the {segment} syntax in the route and how to retrieve them as parameters in the controller method.

Guarda lezione

I'll show you the difference between query parameters in GET requests — passed in the URL after ? — and body data in POST requests, with practical examples tested directly in Postman and read in the controller.

Guarda lezione

Let's build the first two methods of a Laravel in-memory REST API: index, which returns the full list, and show, which retrieves a single record by ID — all logic in PHP arrays with no database.

Guarda lezione

In this lesson we add the store method to handle POST requests and insert data into the in-memory structure, highlighting the limitations of this approach and preparing for the transition to a real database.

Guarda lezione

Let's move from in-memory APIs to a real database: we configure SQLite in Laravel's .env file, create the database file, and use DB Browser to inspect tables visually and intuitively.

Guarda lezione

I'll explain how to create Laravel migrations with Artisan and how the up and down methods work: applying new columns or tables to the database and rolling back changes with a simple rollback command.

Guarda lezione

Let's dive deeper into Laravel migrations with additional practical examples: handling incremental schema changes, performing selective rollbacks, and learning best practices for safely versioning the database.

Guarda lezione

Let's see how to create an Eloquent Model connected to the migration and configure the fillable property to protect the model from mass assignment attacks, securing incoming data assignment.

Guarda lezione

In this lesson we build a complete controller with two core operations: inserting a new record via POST and searching records via GET, connecting Model, route, and Eloquent in a clean flow.

Guarda lezione

Let's complete the GET and POST operations we built and add the destroy method to handle DELETE requests, finishing three of the four CRUD operations in our Laravel REST API.

Guarda lezione

We wrap up the Laravel CRUD by adding the update method with PUT for modifying existing resources, and discover how to use Laravel's Resource Controller to automatically generate and manage all REST routes.

Guarda lezione
Giovanni Pace

Giovanni Pace

Ingegnere Informatico · Pratola Peligna

  • 107 Courses
About the teacher

Sono un ingegnere informatico con oltre 15 anni di esperienza nel settore ICT. Mi occupo di sviluppo software, cybersecurity, data science e intelligenza artificiale, con particolare attenzione all’innovazione e all’automazione dei processi aziendali. Da anni svolgo anche attività di docenza e formazione, creando percorsi pratici e coinvolgenti su programmazione, DevOps, AI e sicurezza informatica.

This course includes

  • Lessons 20
  • Duration 3h 31m
  • Difficulty base
  • Language it
  • Certificate No

Recently viewed