RESTful API with Laravel: Build a Real API with Laravel

Build a RESTful API for a market system using Laravel and dominate the most challenging features of APIs with Laravel

4.35 (1267 reviews)
Udemy
platform
English
language
Web Development
category
instructor
RESTful API with Laravel: Build a Real API with Laravel
7,773
students
15 hours
content
Nov 2022
last update
$84.99
regular price

What you will learn

Create your own projects with Laravel (not only RESTful APIs)

Make the most of your work tools (Sublime Text 3, Git, Github, Composer, PHP artisan and Laravel)

Generate and maintain the structure of the database in an automated way with Laravel and the PHP Artisan console

Use PHP Artisan effectively and be much more efficient

Create and configure your own local development environment

Properly configure your development environment for all your projects

Hone the main HTTP methods/verbs for HTTP and RESTful APIs

Use free professional tools to improve your productivity

Why take this course?

So you need to build a RESTful API for a project, but you do not know even where to start? Do not worry I will guide you through the whole process to build a genuine RESTful API using Laravel.

Join the more than 5.000 students already taking this course, building their RESTful APIs using Laravel, and enjoying every single class!

Note: You can take, and in fact it is recommended, to follow the course using the most recent version of Laravel. Additionally, the course includes extensive sections about how to upgrade your project to different versions of Laravel, in case you decide to use any previous version.

Build your RESTful API with Laravel, using a complete marketplace as the case of use. With Laravel, creating every component will be a breeze. You will have a project with users, sellers, buyers, transactions, products, and categories. Explore all types of relationships, one to many, many to many and much much more using Eloquent the Laravel ORM.



The full guide for creating a real RESTful API with Laravel. You can follow the course using the latest Laravel version (it is recommended).

You will not find a Laravel course like this. This course explains everything you need to develop a RESTful API using the Laravel framework.

At the end of the course, you will have a RESTful API with Laravel, for a market system, where users can purchase and sell different products with different categories and transactions. Inclusive, the same user can be both a seller and a buyer (you will take advantage of inheritance for this).


¡Do Not wait anymore! Become a master in the development of genuinely RESTful APIs with Laravel. Join the course now and see you in class

Remember: The course has been constantly updated to use the latest versions of Laravel. So feel free to use the version you like (especially the latest version of Laravel).


In this course, you learn how to develop a realistic,  fully implemented, and professional RESTful API with Laravel.

Laravel is the most popular PHP framework, with more than 20 million downloads along with lots of enterprise and personal projects worldwide. Additionally, it includes fantastic features to implement a RESTful API easily. Laravel is RESTful friendly.


What is a RESTful API?
A Web API is like a web service that works entirely with HTTP. A RESTful API must follow the REST (REpresentational State Transfer) practices, allowing to orientate the design to the resources, provide standard responses based on the different HTTP status codes, and the corresponding according to Hypermedia Links in responses (HATEOAS).


Why Laravel?
Because Laravel is a framework made by programmers for programmers, expressive, simple, intuitive, and powerful. Laravel provides useful features for web projects including RESTful APIs.

Each new Laravel version includes many changes that make this framework even better, simple, programmer-friendly, and at the same time much more powerful. In fact, the latest versions of Laravel included a lot of new features to help to develop RESTful APIs in the right way.

During this course, you will master the complete structure of Laravel, along with the new features included in the latest version of Laravel to develop an actual RESTful API.

You will learn this about the development of a RESTful API with Laravel:

  • Using the Laravel PHP artisan for code and components generation

  • Usage and creation of middleware on Laravel

  • The Laravel Resource routes and controllers (ideal for RESTful APIs)

  • Fully supported JSON format responses for a JSON RESTful API

  • Validation of requests directly from the Laravel Controllers

  • Handling all types of exceptions and errors from Laravel handler

  • Complex operations involving up to three resources/models for a specific operation

  • Usage of Laravel dependency injection and model binding

  • Generation of the database structure using Laravel migrations

  • Automatic insertion of fake data into the database through "faker," using Laravel factories, and seeders

  • Laravel Sessions and access_token authentication for the RESTful API. Yes, Both!

  • Using Laravel Passport to protect the RESTful API with OAuth2

  • Pagination of results using Laravel collections

  • Using URL parameters to execute actions (the RESTful approach)

  • Sorting results based on URL parameters with a RESTful approach

  • Filtering results using URL parameters

  • Caching responses using Laravel Cache System

  • Limitation of requests using the Laravel middleware

  • Implementing HATEOAS on Laravel (a pure RESTful API must use HATEOAS)

  • Using PHP Fractal for transforming responses

  • Usage of CORS on the API responses to allow JavaScript-based clients and web browsers.

  • Use the Laravel Policies and Gates to handle the user's authorization layer.

  • Much more!!


You can take a look at the full list of contents below. You will finish with a complete RESTful API and understanding a lot of Laravel skills.

You will create an actual RESTful API from scratch and step by step using Laravel. Follow the REST architecture and build appropriate URLs to identify actions and resources using the Laravel best features and learn Laravel in the way.

Take full advantage of tools like Sublime Text 3, Git, power shell, Laravel, Composer, PHP artisan, and be more productive for agile development.

Note: In few classes of the course I use Windows (only for the first classes), but I included specific directions in the case you use Linux or Mac and all the tools used are cross-platform, so you will no have any problem.

You will have lifetime access to the current classes and the classes that I will regularly add (take a look at the last section to see what is coming).

At the end of this course, you will be able to develop your pure RESTful API with Laravel in an efficient way with the best practices, taking advantage of the facilities provided by Laravel for the proper implementation of your projects and your RESTfulAPI.

Do not wait any longer. Join the course and see you in classes.

Content

Introduction

About the Instructor and the Course
Taking Advantage of the Course and Contents

Downloading and Installing the Tools to Develop the RESTful API with Laravel

Downloading and Installing PHP with XAMPP
Downloading and Installing Composer
Downloading and Installing Virtual Box
Downloading and Installing Vagrant
Downloading and Installing Sublime Text 3
Downloading and Installing Github Shell
Downloading and Installing Node and NPM
Downloading and Installing Postman to Test the Laravel RESTful API

Creating and Setting the Initial Structure of Laravel for the RESTful API

Obtaining Laravel Using Composer
Adding Laravel Homestead as a Dependency for The Laravel Project
Laravel 6 additional step
Preparing and Configuring Laravel Homestead
Adding the Virtual Domain on The System
Using Vagrant to Manage the Laravel Homestead Virtual Machine
Exercise Find out how to go out from the Virtual Machine
Keep The Laravel Project Updated

Configuring and Using Sublime Text 3 to Develop the RESTful API with Laravel

Installing the Package Control
Creating and Using Projects
Installing and Using SublimeCodeIntel to Resolve Laravel and RESTful API classes
Installing and Using SideBarEnhancement
Installing and Using SublimeLinter for PHP
Installing and Using PHPCompanion to Auto-import Laravel Definitions

Understanding the Case Study for the RESTful API

Understanding the RESTful API Resources (Models) and its Relationships
Understanding the Main End-Points for the RESTful API

Discovering and Configuring the Laravel Structure for the RESTful API

Discovering the Laravel Structure
Discovering the Laravel PHP Artisan Commands
Configuring the Laravel Environment Variables
Understanding the Laravel Routes System for RESTful APIs

Creating the Initial Laravel Components for the RESTful API

How to Solve Common Errors During the Development of the RESTful API
Creating Initial Laravel Structures for The Models and Its Migrations
Creating an Initial Laravel Structure for The Controllers
Creating Some End-Point for the RESTful API Using Laravel Resource Routes

Implementing the RESTful API Models and its Relationships using Laravel Eloquent

Implementing The Properties for Category
Implementing The Properties for Product
Implementing The Properties for Transaction
Implementing The Properties for User
Implementing The Relationships Between Models

Creating the Database Structure Using Migrations from Laravel

Solving a Common Issue with the Laravel Migrations
Implementing The Migration for Users
Implementing The Migration for Categories
Implementing The Migration for Products
Implementing The Migration for Transactions
Creating the Migration for The Pivot Table

Creating the Laravel Factories for Database Seeding

Creating The Laravel Factory for User
Creating The Factory for Category
Creating The Factory for Product
Creating The Factory for Transaction
Using The Factories from The DatabaseSeeder of Laravel
Executing The Migrations and Seeder using Artisan from Laravel

Implementing the Operations for UserController

Implementing The Index Method for UserController
Implementing The Show Method for UserController
Implementing The Store Method for UserController
Implementing The Update Method for UserController
Implementing The Destroy Method for UserController

Implementing the operations for Buyer

Implementing The Index Method for BuyerController
Implementing The Show Method for BuyerController

Implementing the operations for Seller

Implementing The Index Method for SellerController
Implementing The Show Method for SellerController

Improving the current RESTful API operations

Defining Mutators and Accessor for Models
Generalizing The Response Methods
Using The Generalized Methods
Using The Generalized Methods for Error Responses

Handling Errors and Exceptions with the Laravel Handler

Returning Validation Errors as a JSON Response
Returning Model Not Found Errors as a JSON Response
Handling AuthenticationException
Handling AuthorizationException
Handling NotFoundHttpException
Handling MethodNotAllowedHttpException
Handling General HttpException
Catching Exceptions When Removing Related Resources
Handling Unexpected Exceptions

Implicit Model Binding with Routes and Methods

Using The Laravel Implicit Model Binding for Some Methods
Resolving Buyer Using Laravel Global Scopes
Resolving Seller Using Laravel Global Scopes

Implementing Soft Deleting for All the Models

Modifying the Migrations for Soft Deleting
Using soft Deleting for All the Models

Implementing the Operations for Category

Implementing the Index Method for CategoryController
Implementing the Show Method for CategoryController
Implementing the Store Method for CategoryController
Implementing the Update Method for CategoryController
Implementing the Destroy Method for CategoryController

Implementing the Operations for Product

Implementing the Index Method for ProductController
Implementing the Show Method for ProductController

[Exercises] Implementing the Operations for Transaction

Implementing the Index Method for TransactionController
Implementing the Show Method for TransactionController

Implementing Complex Operations within Transaction

Implementing the Index Method for TransactionCategoryController
Implementing the Index Method for TransactionSellerController

Implementing Complex Operations for Buyer

Implementing the Index Method for BuyerTransactionController
Implementing the Index Method for BuyerProductController
Implementing the Index Method for BuyerSellerController
Implementing the Index Method for BuyerCategoryController

Implementing Complex Operations for Category

Implementing the Index Method for CategoryProductController
Implementing the Index Method for CategorySellerController
Implementing the Index Method for CategoryTransactionController
Implementing the Index Method for CategoryBuyerController
Removing the Pivot Table from the Results

Implementing Complex Operations for Seller

Implementing the Index Method for SellerTransactionController
Implementing the Index Method for SellerCategoryController
Implementing the Index Method for SellerBuyerController
Implementing the Index Method for SellerProductController
Implementing the Store Method for SellerProductController
Implementing the Update Method for SellerProductController
Implementing the Destroy Method for SellerProductController

Implementing Complex Operations for Product

[Challenge] Implementing the Index Operation of ProductTransaction
[Challenge] Implementing the Index Operation of ProductBuyer
[Challenge] Implementing the Index Operation of ProductCategory
Implementing the Update Operation of ProductCategory
Implementing the Destroy Operation of ProductCategory
Implementing the Store Operation for ProductBuyerTransaction
Handling the Products Availability Using Events

Adding an Image for Products

Preparing the API for Images Uploading
Storing an Image When Creating a Product
Removing the Image When Deleting a Product
Updating the Image When Editing a product

Sending Email for Users Accounts Verification

Preparing the Laravel Project for Email Sending
Implementing the Verification System
Creating the Laravel Mailable for User Created
Implementing the UserCreated Mailable
Send Verification Email Using Events
Solving the Problem with Factories
Creating the Mailable for User Mail Changed
Implementing the UserMailChanged Mailable
Send Verification for Email Changed Using Events
Re-sending the Verification Email If Requested
Dealing with Failing-Prone Actions
Using Laravel Markdown Mailables

The Middleware and the Rate Limiting

About the Middleware and How it Works in Laravel
Creating a Custom Middleware
About the Rate Limiting in Laravel and the Details
[Optional] Customizing the Response for “Too Many Attempts”

Transforming Responses with PHP Fractal for Security and Compatibility

About Transformers and Why to Use It
Preparing the Laravel Project for Data Transforming
Creating the Transformer for User
Creating the Transformer for Seller and Buyer
Creating the Transformer for Category
Creating the Transformer for Transaction
Creating the Transformer for Product
Linking the Models with its Respective Transformer
Returning the New Transformed Responses

Sorting and Filtering Results Based on Query Parameters

Sorting Results by Any Attribute
Understanding an Issue with Sorted Responses
Improving the Transformations to Solve the Problem
Implementing the Solution Using Transformers
Filtering Responses Based on Attributes

Pagination of Results

About Pagination
Paginating Already Built Collections
Allowing Custom Page Size

Caching Results with Laravel Cache System

Implementing the Cache System
The Caching System and the Query Parameters

Implementing HATEOAS Hypermedia Controls

What is and Why to Use HATEOAS
Implementing HATEOAS Hypermedia Controls for Category Instances
Implementing HATEOAS Hypermedia Controls for Product Instances
Implementing HATEOAS for Transaction Instances
Implementing HATEOAS for User Instances
[Exercise] Implementing HATEOAS for Buyer
[Exercise] Implementing HATEOAS for Seller

The Transformations and the Validations

Understanding Two Problems with Transformations and Validations
Creating and Using a Middleware to Solve the Problem
Solving the First Problem Using the Middleware
Improving the Transformations to Solve the Second Problem
Improving the Middleware to Solve the Second Problem

Preparing the API for User Authentication Using Sessions

Why is It Required for Our API
Laravel 6: Before to continue...
Creating the Additional Authentication Structure
Tuning Some Structures to Avoid Inconsistences
About CSRF and Handling CSRF Exceptions in Laravel
Returning HTML and Redirections When Required

Using Laravel Passport to Implement the Initial Security Layer with OAuth2

About OAuth2 and Security on APIs
What is Laravel Passport
Preparing the Laravel Project to Use Laravel Passport
Using the Migrations of Laravel Passport
Installing Laravel Passport Definitively on the API
Making Users Authenticatable Through API Tokens
Registering the Required Routes
Configuring the Authentication System
Defining the Expiration Time for the Tokens
Using client_credentials Grant to Protect Some Routes
How to Obtain and Use Tokens Using Client Credentials
Protecting All the Routes
Using the Password Grant Type
Preparing the API to Use the Passport Components
Creating the Views to Manage the Personal Tokens
About the Personal Tokens and How to Use It
Allowing the Management of API Clients
About the Authorization Code Grant Type
Using the Implicit Grant Type
Refreshing Tokens

Restricting OAuth2 Clients Using Scopes

What are Scopes on OAuth2?
Registering Some Required Scopes for the API
Registering the Laravel Passport Middleware to Check Scopes
Restricting the Action that Needs the “purchase-product” Scope
Restricting the Actions that Need the “manage-products” Scope
Restricting the Actions that Need the “manage-account” Scope
Restricting the Actions that Need the “read-general” Scope

Implementing the Final Security Layer Using Policies and Gates of Laravel

About the Final Security Layer
What are Policies and Gates on Laravel?
Implementing the Restrictions Over Buyer
Implementing the Restrictions Over Seller
The Restrictions over User
Implementing the Restrictions Over Transaction
Implementing the Restrictions Over Product
Allowing All Actions for Admin Users
Allowing Remaining Actions ONLY Admin Users Can Do

CORS for Laravel

About CORS
Installing the CORS Package for Laravel
Configuring the CORS Package
Allowing CORS Only for the API
Allowing CORS on Error Responses Too

Additions and Fixes for the Laravel RESTful API

Identifying an Authenticated User in the RESTful API

[Optional] Upgrading to Laravel 5.5

About the Upgrading Process to Laravel 5.5
Upgrading to Laravel 5.5 Along With Dependencies
Upgrading the Source Code According to Laravel 5.5

[Optional] Upgrading to Laravel 5.6

Preparing the Environment to Upgrade
Obtaining Laravel 5.6
Installing Updated Dependencies
Solving Issues and Updating the Project Structure

[Optional] Upgrading to Laravel 5.7

Preparing the development environment to upgrade
Installing Laravel 5.7 an upgrading dependencies for the RESTful API
Upgrading the components and structures

[Optional] Upgrading to Laravel 6

Upgrading the development environment
Obtaining Laravel 6 and upgrading the dependencies
Resolving the issues to use Laravel 6

Conclusion

List of Pending Topics
Thanks for Be Here!

Screenshots

RESTful API with Laravel: Build a Real API with Laravel - Screenshot_01RESTful API with Laravel: Build a Real API with Laravel - Screenshot_02RESTful API with Laravel: Build a Real API with Laravel - Screenshot_03RESTful API with Laravel: Build a Real API with Laravel - Screenshot_04

Reviews

Manuel
May 29, 2023
Appreciate the instructor going through detailed exercises. It's not too repetitive, I think it's actually very relevant to go through many examples and edge cases to get a better hang of things. I think it's a great start point with good context and detail. I think however for entry level engineers/developers, architectural decisions made here are an example and should not be taken as a must do for projects, analyze pros of certain DB design decisions, product and other scalability decisions complementing with courses on those matters or other references. But on laravel's subject, this is a great reference to start and also as a web developer it's a great resource to get into the world of software engineering and/or web development.
Edyta
September 24, 2022
Excellent, above expectations! This is a very well-thought-out and executed course. Even though the course is based on the old Laravel version (5.4), I didn't have any problems following it on the latest, Laravel 9 version (of course, I had to research and adjust the code to make it work with the newest Laravel, but that's why we're programmers right? :-) ) I did a couple of other Juan's courses, and he's one of my favorite instructors.
Ricky
September 5, 2022
I just completed this course today on September 5, 2022. Although this course was created some 5 or 6 years ago, I still have found this course to be absolutely amazing! The instructor's English and pronunciation isn't perfect, but if you look past the surface you will find the instructor to be extremely knowledgeable and the contents will more than make up for it. I am using Laravel 8 instead of Laravel 5 that the instructor was using, but I was still able to make everything work. Yes, it did take me extra time to research and align his codes to more updated ones, but it was absolutely doable. In fact, I found it actually helped me look deeper into understand development using Laravel. I'm not one to write feedback at all but I just felt compelled to do it here seeing how this course current rating doesn't do it justice. I hope you will find joy in learning from this course as much as I did. Good luck!
Rahwee
August 30, 2022
I give 5 even this course still in older version of laravel. I follow the course by using newer version of laravel. When I stuck in any part of tutorial, he always response to any of my questions. So that, I can keep going through the course. Thank for ur course, Happy learning.
Angela
May 23, 2022
Great detail of the overview of the concepts of Laravel and setup. I look forward to diving in and learning the details of implementing a RESTful API endpoint in Laravel.
Yograj
May 1, 2022
Unable to understand the content. They are not using all the resources given in laravel documents. Making things difficult for beginner and intermediate developers.
Ivo
February 24, 2022
(still) an awesome course on Laravel and API's in general. I've built a couple of API's myself over the years but the code always ended up a little messy and hard to maintain. Thanks to Don Juan my fire for building API's has reignited! ;) I followed this course using Laravel 8 (9 just came out) which presented some interesting issues since Juan is using Laravel 5. Nothing unsolvable though and it, in my opnion, gives the student of this course an extra challenge to update and get the code working again. Thanks Juan, love your teaching style and the fire with which you present your courses!
George
January 17, 2022
I have knowledge of laravel 8 and now interested in building my knowledge on API's. Good introduction so far.
Sunil
December 23, 2021
DO NOT BUY THIS COURSE. Nothing but problems with dependencies and versions ever since I started this course. This is an old course with old version of Laravel. Too many problems and conflicts right from the get go. I need a refund.
Saad
May 28, 2021
This course is pretty good. I got new programming paradigm form this course, especially in API development. Unfortunately, there is no tutorial talking together along this course about making CRUD using datatables. I'll give 5 stars for the next update if the instructor adding the feature.
Oscar
January 23, 2021
I'm just past the setup sections and I had to do a lot of my own research to troubleshoot and workaround a lot of stuff since this course is already pretty outdated
Priyanka
July 6, 2018
It's really awesome. When I started I was blank in Laravel. And after watching this series I have learnt a lot and I gain a confidence in Laravel. Thanks a lot for making this awesome series.
Tomislav
June 3, 2018
Great course. It teaches exactly what is declared! Juan answers the questions very, very fast. I build two apis along with this course, and they work as expected.
pong
May 24, 2018
Hi, Juan D Megan: Now I have reached Lecture 57, thank you for your teaching, you did a great job. now I can understand your accent and words, thank god, it very funny you put on so many proverbs, but I like it. I wish you keep doing well and enjoy your teaching.
Kubilay
May 16, 2018
I didn't want to get my hands on all capabilities of Laravel, instead I only needed a strong RESTful API for my Angular project. I was surprised that I found this course, almost was made exactly for my needs. Juan is not a native so at first you might think the accent is hard to follow but it isn't, he's also focused on providing samples for each and every case so you can easily get going with the whole concept. The course also contains extra content for security, authorization and improving the overall project, it's absolutely more than what you need. Juan is also very quick and helpful with his responses. Many thanks to him for this course.

Charts

Price

RESTful API with Laravel: Build a Real API with Laravel - Price chart

Rating

RESTful API with Laravel: Build a Real API with Laravel - Ratings chart

Enrollment distribution

RESTful API with Laravel: Build a Real API with Laravel - Distribution chart

Related Topics

1109150
udemy ID
2/10/2017
course created date
11/23/2019
course indexed date
Bot
course submited by