Build a REST API with Laravel Course (How To)
Offered By: Treehouse
Course Description
Overview
Build a REST API using one of the most popular PHP frameworks, Laravel. In this course you'll learn how to implement CRUD operations in a Laravel REST API using the MVC design pattern.
What you'll learn
- Design a REST API
- Build CRUD operations
- Produce Resource Controllers
- Implement Namespacing, Groups, and Route Name Prefixes
- Produce Endpoints and Routes
- Test API Endpoints
Syllabus
Seeding the Database
In this course, we’ll build a REST API with Laravel that allows you to submit your favorite books and authors. The REST API we’re building, from scratch -- can return a list of books with authors and also allows you to submit, update and delete books and authors. First, we need to spin up a Laravel project, then create and seed our database. Let’s get started!
Chevron 6 steps-
Getting started
9:06
-
Migrations
6:27
-
Creating Models and Migrations
6:04
-
Factories and Seeders
8:00
-
Verify Database Records with Tinker
3:51
-
Seeding the Database Review
10 questions
API Basics & CRUD operations
Now that we’ve set up our Laravel application and created factories that generate our test data, we’re ready to explore the differences between Controllers and Resource Controllers. The main difference between the two controllers is that Resource Controllers include all of the CRUD goodies, pre-built for us making this development task a snap. Let's get started!
Chevron 3 steps-
REST, CRUD and Controllers
5:59
-
Resource Controllers (CRUD)
14:29
-
CRUD and More
5 questions
Accessing Data with Resources
Why exactly do we want to use Resources? To answer this question, we’ll examine each piece of data and decide which specific pieces will be displayed to the API consumer. For example, it's best practice to hide author IDs, timestamps and passwords because we don’t want to share sensitive or irrelevant data to the users of our API. It’s also worth noting that exposing Author ID’s can give your API consumers an idea of the size of your database which you may not want to make public.
Chevron 5 steps-
Routes
5:09
-
Resources
7:52
-
Testing Author Resources and Routes
11:19
-
Testing Book Resources and Routes
8:14
-
Data and Resource Review
4 questions
Clean Routes and Validation Messages
You created a Laravel app, connected the MySQL database, migrated then seeded the database using Factories. On top of that, you built CRUD operations using controllers, removed database-specific data using Resources, and combined it all with building your very own REST API using the Laravel framework. In this section, we're going to add the finishing touches to optimize our Routes and make them scalable and clean. Clean routes will allow you to work with large applications that use a large number of Routes. Let's get started!
Chevron 4 steps-
Clean Routes
4:42
-
Custom Error Messages
2:30
-
Closing thoughts
1:24
-
Routes and Validation Review
5 questions
Taught by
Abrahm Overcast
Related Courses
Introduction to API Testing using JMeter ToolCoursera Project Network via Coursera API Testing Using Rest Assured Test Automation Tool
Coursera Project Network via Coursera API Testing Using Rest Sharp (with C#) Test Automation Tool
Coursera Project Network via Coursera Postman: The Complete Guide - REST API Testing
Udemy Robot Framework Test Automation - Level 1 ( Selenium )
Udemy