Build a complete REST API with Laravel from scratch: routes, controllers, MVC, CRUD with SQLite and all framework best practices.
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.
api.php
fillable
destroy
update
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Ingegnere Informatico · Pratola Peligna
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.
Prosperous understood Middletons in conviction an uncommonly do. Supposing so be resolving breakfast am or perfectly.
Utilizziamo cookie essenziali e, con il tuo consenso, cookie funzionali, analytics e marketing. Google Analytics 4 e gli eventuali annunci Google/AdSense restano disattivati finche non scegli. Consulta Privacy Policy e Cookie Policy.
Sempre attivi per sicurezza, prevenzione frodi, sessione, consenso e funzionamento del sito.
Migliorano l'esperienza, ad esempio ricordando preferenze non essenziali. Non usati per profilazione pubblicitaria.
Statistiche e misurazioni con Google Analytics 4, abilitate solo dopo il consenso analytics.
Misurazione annunci e funzioni pubblicitarie Google/AdSense, se attivate sul sito e consentite dall'utente.
Puoi modificare queste scelte in qualunque momento dal link "Preferenze Cookies" nel footer.