Skip to main content

RESTful API with Laravel: Build a real API with Laravel

14h 30m 19s
English
Paid

Build a genuine RESTful API with Laravel, using a complete marketplace as a case study. Laravel makes creating each component effortless. By the end of this course, you'll have a project featuring users, sellers, buyers, transactions, products, and categories. You'll explore various relationships, including one-to-many, many-to-many, and more using Eloquent, Laravel's ORM.

Course Overview

Need to build a RESTful API but don't know where to start? Don't worry, this course will guide you through the entire process of creating a genuine RESTful API using Laravel. The course is designed to be followed with the latest version of Laravel, and it includes comprehensive sections on upgrading your project to newer Laravel versions if needed.

Course Highlights

  • Develop a Real RESTful API: By the end of this course, you'll have a fully functional RESTful API for a market system where users can engage in buying and selling activities. This includes learning how the same user can function as both a seller and a buyer using inheritance.
  • Constantly Updated: The course is regularly updated to ensure compatibility with the latest Laravel versions.
  • Master Laravel: Gain insights into Laravel's structure and take advantage of its latest features for developing RESTful APIs.

Why Choose Laravel?

Popularity and Features: Laravel is a leading PHP framework, downloaded over 20 million times, and is favored for its robust features that simplify RESTful API development.

RESTful Friendly: Each new version of Laravel introduces enhancements that bolster its capability to develop RESTful APIs efficiently.

What You Will Learn

  • Generate code and components with Laravel PHP artisan
  • Create and utilize middleware effectively
  • Implement resource routes and controllers
  • Deliver JSON format responses efficiently
  • Validate requests via Laravel controllers
  • Handle exceptions and errors with Laravel’s handler
  • Perform complex operations involving multiple resources/models
  • Use Laravel's dependency injection and model binding
  • Automate database structure creation with Laravel migrations
  • Insert fake data seamlessly using Laravel factories and seeders
  • Authenticate using Laravel Sessions and access_token
  • Safeguard the API with Laravel Passport and OAuth2
  • Employ pagination, sorting, and filtering using URL parameters
  • Implement caching for enhanced performance
  • Integrate HATEOAS for a pure RESTful API experience
  • Transform responses using PHP Fractal
  • Apply CORS on API responses for browser-based clients
  • Handle user authorization with Laravel Policies and Gates
  • And much more!

Course Details

You'll design and implement a RESTful API from scratch, using Laravel's best practices to craft appropriate URLs for actions and resources. Throughout the course, you'll utilize tools like Sublime Text 3, Git, PowerShell, Laravel, Composer, and PHP artisan to enhance your productivity and development agility.

Note: Early sessions use Windows, but directions are provided for Linux and Mac users. All tools are cross-platform compatible.

Gain lifetime access to current and future course content, ensuring your skills remain modern and competitive. At the course's conclusion, you'll be equipped to develop a pure RESTful API using Laravel with best practices and Laravel’s powerful tools.

Course Requirements

  • A solid understanding of Object Oriented Programming
  • Basic PHP knowledge (classes, functions, methods, traits, inheritance)

Who This Course is For

  • Web development and PHP enthusiasts
  • Individuals aiming to develop a complete RESTful API
  • Anyone wanting to build a fully functional RESTful API step-by-step
  • Those eager to keep current skills updated and competitive
  • Developers wanting to comprehensively build projects with Laravel

Learning Outcomes

  • Create projects with Laravel beyond RESTful APIs
  • Optimize tool usage (Sublime Text 3, Git, GitHub, Composer, PHP artisan, Laravel)
  • Automatically manage database structures with Laravel and PHP Artisan console
  • Effectively utilize PHP Artisan for greater efficiency
  • Set up and configure your local development environment properly
  • Refine your understanding of key HTTP methods/verbs for RESTful APIs
  • Leverage free professional tools to boost productivity

Don't delay any longer. Enroll now and see you in class!

About the Author: udemy

udemy thumbnail
By connecting students all over the world to the best instructors, Udemy is helping individuals reach their goals and pursue their dreams. Udemy is the leading global marketplace for teaching and learning, connecting millions of students to the skills they need to succeed. Udemy helps organizations of all kinds prepare for the ever-evolving future of work. Our curated collection of top-rated business and technical courses gives companies, governments, and nonprofits the power to develop in-house expertise and satisfy employees’ hunger for learning and development.

Watch Online 214 lessons

This is a demo lesson (10:00 remaining)

You can watch up to 10 minutes for free. Subscribe to unlock all 214 lessons in this course and access 10,000+ hours of premium content across all courses.

View Pricing
0:00
/
#1: About the Instructor and the Course
All Course Lessons (214)
#Lesson TitleDurationAccess
1
About the Instructor and the Course Demo
01:33
2
Taking Advantage of the Course and Contents
02:34
3
Downloading and Installing PHP with XAMPP
02:34
4
Downloading and Installing Composer
02:11
5
Downloading and Installing Virtual Box
01:49
6
Downloading and Installing Vagrant
02:02
7
Downloading and Installing Sublime Text 3
02:25
8
Downloading and Installing Github Shell
03:59
9
Downloading and Installing Node and NPM
03:28
10
Downloading and Installing Postman to Test the Laravel RESTful API
02:50
11
Obtaining Laravel Using Composer
01:58
12
Adding Laravel Homestead as a Dependency for The Laravel Project
01:27
13
Preparing and Configuring Laravel Homestead
04:21
14
Adding the Virtual Domain on The System
02:19
15
Using Vagrant to Manage the Laravel Homestead Virtual Machine
04:50
16
Keep The Laravel Project Updated
03:34
17
Installing the Package Control
01:36
18
Creating and Using Projects
02:19
19
Installing and Using SublimeCodeIntel to Resolve Laravel and RESTful API classes
03:01
20
Installing and Using SideBarEnhancement
02:09
21
Installing and Using SublimeLinter for PHP
02:16
22
Installing and Using PHPCompanion to Auto-import Laravel Definitions
04:01
23
Understanding the RESTful API Resources (Models) and its Relationships
04:16
24
Understanding the Main End-Points for the RESTful API
03:29
25
Discovering the Laravel Structure
07:30
26
Discovering the Laravel PHP Artisan Commands
04:54
27
Configuring the Laravel Environment Variables
04:03
28
Understanding the Laravel Routes System for RESTful APIs
03:02
29
Creating Initial Laravel Structures for The Models and Its Migrations
04:45
30
Creating an Initial Laravel Structure for The Controllers
03:35
31
Creating Some End-Point for the RESTful API Using Laravel Resource Routes
06:51
32
Implementing The Properties for Category
02:17
33
Implementing The Properties for Product
03:46
34
Implementing The Properties for Transaction
01:18
35
Implementing The Properties for User
05:43
36
Implementing The Relationships Between Models
05:30
37
Solving a Common Issue with the Laravel Migrations
02:43
38
Implementing The Migration for Users
02:28
39
Implementing The Migration for Categories
01:11
40
Implementing The Migration for Products
02:02
41
Implementing The Migration for Transactions
01:37
42
Creating the Migration for The Pivot Table
04:46
43
Creating The Laravel Factory for User
03:23
44
Creating The Factory for Category
01:27
45
Creating The Factory for Product
03:52
46
Creating The Factory for Transaction
04:54
47
Using The Factories from The DatabaseSeeder of Laravel
06:06
48
Executing The Migrations and Seeder using Artisan from Laravel
05:11
49
Implementing The Index Method for UserController
02:52
50
Implementing The Show Method for UserController
02:30
51
Implementing The Store Method for UserController
07:31
52
Implementing The Update Method for UserController
08:26
53
Implementing The Destroy Method for UserController
01:39
54
Implementing The Index Method for BuyerController
02:44
55
Implementing The Show Method for BuyerController
01:35
56
Implementing The Index Method for SellerController
02:16
57
Implementing The Show Method for SellerController
01:34
58
Defining Mutators and Accessor for Models
05:27
59
Generalizing The Response Methods
05:54
60
Using The Generalized Methods
03:10
61
Using The Generalized Methods for Error Responses
01:54
62
Returning Validation Errors as a JSON Response
04:37
63
Returning Model Not Found Errors as a JSON Response
03:00
64
Handling AuthenticationException
02:43
65
Handling AuthorizationException
02:09
66
Handling NotFoundHttpException
02:03
67
Handling MethodNotAllowedHttpException
02:16
68
Handling General HttpException
01:34
69
Catching Exceptions When Removing Related Resources
04:11
70
Handling Unexpected Exceptions
04:29
71
Using The Laravel Implicit Model Binding for Some Methods
02:51
72
Resolving Buyer Using Laravel Global Scopes
04:43
73
Resolving Seller Using Laravel Global Scopes
02:01
74
Modifying the Migrations for Soft Deleting
02:16
75
Using soft Deleting for All the Models
03:15
76
Implementing the Index Method for CategoryController
03:10
77
Implementing the Show Method for CategoryController
01:25
78
Implementing the Store Method for CategoryController
03:03
79
Implementing the Update Method for CategoryController
04:10
80
Implementing the Destroy Method for CategoryController
02:02
81
Implementing the Index Method for ProductController
02:27
82
Implementing the Show Method for ProductController
01:17
83
Implementing the Index Method for TransactionCategoryController
04:26
84
Implementing the Index Method for TransactionSellerController
04:25
85
Implementing the Index Method for BuyerTransactionController
02:55
86
Implementing the Index Method for BuyerProductController
06:40
87
Implementing the Index Method for BuyerSellerController
05:08
88
Implementing the Index Method for BuyerCategoryController
05:31
89
Implementing the Index Method for CategoryProductController
02:43
90
Implementing the Index Method for CategorySellerController
03:43
91
Implementing the Index Method for CategoryTransactionController
05:16
92
Implementing the Index Method for CategoryBuyerController
05:24
93
Removing the Pivot Table from the Results
01:48
94
Implementing the Index Method for SellerTransactionController
03:13
95
Implementing the Index Method for SellerCategoryController
02:22
96
Implementing the Index Method for SellerBuyerController
03:04
97
Implementing the Index Method for SellerProductController
02:51
98
Implementing the Store Method for SellerProductController
07:32
99
Implementing the Update Method for SellerProductController
07:19
100
Implementing the Destroy Method for SellerProductController
02:16
101
[Challenge] Implementing the Index Operation of ProductTransaction
04:24
102
[Challenge] Implementing the Index Operation of ProductBuyer
04:18
103
[Challenge] Implementing the Index Operation of ProductCategory
04:18
104
Implementing the Update Operation of ProductCategory
07:43
105
Implementing the Destroy Operation of ProductCategory
02:34
106
Implementing the Store Operation for ProductBuyerTransaction
11:54
107
Handling the Products Availability Using Events
03:14
108
Preparing the API for Images Uploading
03:31
109
Storing an Image When Creating a Product
04:11
110
Removing the Image When Deleting a Product
02:33
111
Updating the Image When Editing a product
04:26
112
Preparing the Laravel Project for Email Sending
06:16
113
Implementing the Verification System
05:38
114
Creating the Laravel Mailable for User Created
01:48
115
Implementing the UserCreated Mailable
04:27
116
Send Verification Email Using Events
03:32
117
Solving the Problem with Factories
02:51
118
Creating the Mailable for User Mail Changed
01:19
119
Implementing the UserMailChanged Mailable
02:04
120
Send Verification for Email Changed Using Events
03:25
121
Re-sending the Verification Email If Requested
03:23
122
Dealing with Failing-Prone Actions
03:25
123
Using Laravel Markdown Mailables
09:23
124
About the Middleware and How it Works in Laravel
05:35
125
Creating a Custom Middleware
09:03
126
About the Rate Limiting in Laravel and the Details
04:22
127
[Optional] Customizing the Response for “Too Many Attempts”
03:30
128
About Transformers and Why to Use It
05:36
129
Preparing the Laravel Project for Data Transforming
03:12
130
Creating the Transformer for User
07:36
131
Creating the Transformer for Seller and Buyer
02:25
132
Creating the Transformer for Category
01:20
133
Creating the Transformer for Transaction
02:02
134
Creating the Transformer for Product
02:46
135
Linking the Models with its Respective Transformer
03:10
136
Returning the New Transformed Responses
10:07
137
Sorting Results by Any Attribute
06:19
138
Understanding an Issue with Sorted Responses
03:09
139
Improving the Transformations to Solve the Problem
03:31
140
Implementing the Solution Using Transformers
02:45
141
Filtering Responses Based on Attributes
06:42
142
About Pagination
03:58
143
Paginating Already Built Collections
08:27
144
Allowing Custom Page Size
03:23
145
Implementing the Cache System
04:14
146
The Caching System and the Query Parameters
06:18
147
What is and Why to Use HATEOAS
03:39
148
Implementing HATEOAS Hypermedia Controls for Category Instances
06:43
149
Implementing HATEOAS Hypermedia Controls for Product Instances
03:11
150
Implementing HATEOAS for Transaction Instances
02:26
151
Implementing HATEOAS for User Instances
01:57
152
Understanding Two Problems with Transformations and Validations
02:39
153
Creating and Using a Middleware to Solve the Problem
05:53
154
Solving the First Problem Using the Middleware
04:04
155
Improving the Transformations to Solve the Second Problem
02:39
156
Improving the Middleware to Solve the Second Problem
07:54
157
Why is It Required for Our API
02:29
158
Creating the Additional Authentication Structure
03:06
159
Tuning Some Structures to Avoid Inconsistences
03:36
160
About CSRF and Handling CSRF Exceptions in Laravel
05:41
161
Returning HTML and Redirections When Required
08:01
162
About OAuth2 and Security on APIs
03:52
163
What is Laravel Passport
01:55
164
Preparing the Laravel Project to Use Laravel Passport
01:59
165
Using the Migrations of Laravel Passport
02:33
166
Installing Laravel Passport Definitively on the API
03:00
167
Making Users Authenticatable Through API Tokens
02:09
168
Registering the Required Routes
03:21
169
Configuring the Authentication System
01:38
170
Defining the Expiration Time for the Tokens
03:24
171
Using client_credentials Grant to Protect Some Routes
06:18
172
How to Obtain and Use Tokens Using Client Credentials
03:25
173
Protecting All the Routes
05:38
174
Using the Password Grant Type
04:48
175
Preparing the API to Use the Passport Components
08:11
176
Creating the Views to Manage the Personal Tokens
05:05
177
About the Personal Tokens and How to Use It
02:41
178
Allowing the Management of API Clients
07:57
179
About the Authorization Code Grant Type
09:38
180
Using the Implicit Grant Type
05:56
181
Refreshing Tokens
05:20
182
What are Scopes on OAuth2?
03:09
183
Registering Some Required Scopes for the API
05:51
184
Registering the Laravel Passport Middleware to Check Scopes
03:55
185
Restricting the Action that Needs the “purchase-product” Scope
04:43
186
Restricting the Actions that Need the “manage-products” Scope
05:28
187
Restricting the Actions that Need the “manage-account” Scope
03:52
188
Restricting the Actions that Need the “read-general” Scope
08:34
189
About the Final Security Layer
03:42
190
What are Policies and Gates on Laravel?
04:05
191
Implementing the Restrictions Over Buyer
07:43
192
Implementing the Restrictions Over Seller
07:16
193
The Restrictions over User
07:33
194
Implementing the Restrictions Over Transaction
05:01
195
Implementing the Restrictions Over Product
05:05
196
Allowing All Actions for Admin Users
06:15
197
Allowing Remaining Actions ONLY Admin Users Can Do
08:43
198
About CORS
04:11
199
Installing the CORS Package for Laravel
01:35
200
Configuring the CORS Package
03:35
201
Allowing CORS Only for the API
04:19
202
Allowing CORS on Error Responses Too
05:27
203
Identifying an Authenticated User in the RESTful API
06:05
204
About the Upgrading Process to Laravel 5.5
03:31
205
Upgrading to Laravel 5.5 Along With Dependencies
04:24
206
Upgrading the Source Code According to Laravel 5.5
06:30
207
Preparing the Environment to Upgrade
05:20
208
Obtaining Laravel 5.6
03:37
209
Installing Updated Dependencies
02:40
210
Solving Issues and Updating the Project Structure
05:42
211
Preparing the development environment to upgrade
03:51
212
Installing Laravel 5.7 an upgrading dependencies for the RESTful API
04:52
213
Upgrading the components and structures
05:25
214
Thanks for Be Here!
01:42
Unlock unlimited learning

Get instant access to all 213 lessons in this course, plus thousands of other premium courses. One subscription, unlimited knowledge.

Learn more about subscription