Video course · Laravel 11
Build a Laravel API
A free, 24-part course: build a production-ready API with Laravel 11, from a fresh install to an API that is documented, tested and monitored.
24 episodes7h 15m5 chaptersFree
Intermediate
We start from a fresh Laravel 11 install and finish with an API that’s documented, tested and monitored: a “Ping” API that watches your websites and services and tells you when something goes down. Each episode picks up the code from the one before, so it’s worth watching them in order.
It’s aimed at PHP and Laravel developers who know the basics and want to see how a real API actually gets designed, secured and looked after once people start depending on it.
I originally made this course for Treblle’s API Academy, and I’m resharing it here with their permission.
The curriculum
24 episodes, watched in order.
The foundations
Episodes 1–4- 1
Setting Up a Laravel 11 API Project
Start building a real-world API with Laravel 11. In this first episode we set up a fresh project that we'll use for the rest of the course: a "Ping" API that monitors your websites and services and al15:58 - 2
Cleaning Up Laravel for an API-First Project
A fresh Laravel install comes with things an API doesn't need. In this episode we strip the project back and reconfigure it for an API-first approach, so it stays lean, fast and easy to maintain as it16:20 - 3
Data Modeling & Eloquent Relationships for APIs
Good APIs start with good data. In this episode we design the data structure for our Ping API: the models, the migrations and the relationships between them in Laravel 11.24:28 - 4
How to Design an API Before You Build It
Every API should solve a real problem. In this episode we step away from code to design the Ping API properly: what it does, who uses it and which endpoints it needs.33:10
How the API behaves
Episodes 5–12- 5
API Authentication & Authorization in Laravel
Who can use your API, and what are they allowed to do? In this episode we add authentication and authorization to the Ping API, so that only the right users can reach the right endpoints.14:16 - 6
Rate Limiting Your Laravel API
Don't let anyone flood your API with endless requests. In this short episode we add rate limiting to protect the Ping API and keep it fair for everyone who uses it.8:25 - 7
API Versioning Strategies in Laravel
Versioning can look like a small detail, but it decides how well your API copes with change. In this episode we look at how to version a Laravel API so you can keep improving it without breaking the a22:23 - 8
Paginating API Responses in Laravel
Returning thousands of records in one response is slow and hard to work with. In this episode we add pagination to the Ping API so large lists stay fast and easy for clients to use.11:44 - 9
API Standards vs Consistency: What Really Matters
API standards are useful, but they aren't everything. In this episode we look at why consistency and discoverability often matter more, and how to apply both to a Laravel API.26:18 - 10
Consistent API Error Handling in Laravel 11
Good error responses make an API far easier to use. In this episode we build on Laravel 11's error handling to return errors in a consistent, informative format based on the API Problem specification,26:50 - 11
Create, Update & Delete Resources in a Laravel API
Now it's time to change some data. In this episode we take a real-world approach to creating, validating, updating and deleting resources in the Ping API, including authorization and when to process w29:31 - 12
Internationalization (i18n) for Laravel APIs
Your API's users might not all speak the same language. In this episode we add internationalization to the Ping API so it can return messages and content in different languages.11:45
Speed, security and background work
Episodes 13–17- 13
Caching Data to Speed Up Your Laravel API
Why hit the database for the same data again and again? In this episode we add caching to the Ping API to cut response times and reduce load on the database.18:09 - 14
Essential Security for Laravel APIs
Security is a chance to build strong, layered defences around your API. In this episode we cover the basic security measures every Laravel API should have.9:54 - 15
HTTP Caching for Laravel API Responses
Caching doesn't stop at your database. In this short episode we use Laravel 11's built-in HTTP features to cache API responses, making them faster for clients and lighter on your server.8:41 - 16
Scheduling Tasks & Sending HTTP Requests in Laravel
This is where the Ping API actually starts pinging. In this episode we use Laravel's task scheduler to automate background jobs and send HTTP requests that check whether your services are up.40:34 - 17
Sending Notifications from a Laravel API
When a service goes down, someone needs to know about it. In this episode we use Laravel notifications to alert users when something goes wrong, such as a failed check in the Ping API.15:58
Keeping it healthy
Episodes 18–19- 18
Monitoring & Logging Your Laravel API
You can't fix what you can't see. In this episode we set up monitoring and logging to get a clear, real-time picture of how the Ping API is performing.21:34 - 19
Testing Your Laravel API
Tests are what let you ship changes with confidence. In this episode we write tests for the Ping API to make sure it behaves exactly as expected.18:02
Going further
Episodes 20–24- 20
Building Laravel APIs with API Platform
Laravel has long been a favourite for full-stack apps, but what about API-first projects? In this episode we introduce API Platform for Laravel and see how it can speed up building the Ping API.17:17 - 21
Feature Flags in a Laravel API
Ship new features safely by turning them on and off without redeploying. In this episode we add feature flags to the Ping API to control which users see which features.11:07 - 22
WebSockets for APIs in Laravel
A lot of developers assume WebSockets have no place in an API. In this episode we show why that isn't true and add real-time updates to the Ping API.9:59 - 23
Adding Search to a Laravel API with Typesense
Search is one of the most overlooked API features. In this episode we add fast search to the Ping API using Typesense, a powerful open-source search engine.15:31 - 24
Documenting Your Laravel API with OpenAPI
In the final episode we document the Ping API. API Platform creates an OpenAPI 3.1 specification for you, so both developers and tools can understand your API straight away.7:07