RESTful API with Laravel: Build a Real API with Laravel
4.2 (948 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
5,092 students enrolled

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.2 (948 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
5,092 students enrolled
Last updated 6/2020
English [Auto], Italian [Auto], 1 more
  • Portuguese [Auto]
Current price: $34.99 Original price: $49.99 Discount: 30% off
5 hours left at this price!
30-Day Money-Back Guarantee
This course includes
  • 14.5 hours on-demand video
  • 9 articles
  • 3 downloadable resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll 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
Course content
Expand all 226 lectures 14:49:34
+ Introduction
3 lectures 04:53

Learn more about the instructor, his experience and knowledge, and the motivations for the creation of this course.

Preview 01:32

First fundamental topics about RESTful APIs and how to take advantage of the different contents depending of your skills.

Taking Advantage of the Course and Contents

Through the question system, you can solve your doubts, but it is very important that you ask them in the right way to help you better.

How to Ask Questions
+ Downloading and Installing the Tools to Develop the RESTful API with Laravel
8 lectures 21:09

XAMPP is a multi-platform project that allows you to easily manage different services like Apache, MySQL, PHP, among others. During this class we will install them, mainly to use PHP in the system

Downloading and Installing PHP with XAMPP

Composer allows you to install and manage dependencies of multiple PHP projects, which includes Laravel. During this class, you will see how from the PHP installation of the previous class you can easily install composer.

Downloading and Installing Composer

Virtual Box is a very popular Oracle project for hardware virtualization, allowing the creation of virtual machines of any kind within your system.

Downloading and Installing Virtual Box

Vagrant is a project that will help you to manage virtual machines completely configured and prepared for different tasks within Virtual Box.

Downloading and Installing Vagrant

Sublime Text 3 is the recent version of one of the most popular code editors. It is used for development in multiple programming languages and counts with a very active community that offers an infinity of plugins and packages to improve ts functionalities.

Downloading and Installing Sublime Text 3

Through Git Shell you can run multiple advanced commands that are not available on Windows systems. It is highly recommended to install this tool to follow the course without problems and access a variety of commands that are not available natively on Windows. If you use another operating system, you can skip this step. However, that can also be a great tool

Downloading and Installing Github Shell

Node is a system mainly useful for tasks related to the frontend. We will install it, to access NPM which facilitates the management of dependencies for the frontend. It is like Composer, but instead of PHP, it's for CSS and JavaScript.

Downloading and Installing Node and NPM

Postman is a very popular tool in the APIs ecosystem. Through this program, we will be able to make any requests to our API and check all the functionalities class by class.

Downloading and Installing Postman to Test the Laravel RESTful API
+ Creating and Setting the Initial Structure of Laravel for the RESTful API
7 lectures 18:39

During this class you will learn how to get the initial basic structure of any Laravel project, using composer.

Obtaining Laravel Using Composer

Homestead is a vagrant box that will allow us to quickly build a complete virtual machine designed for Laravel projects primarily. Homestead is a project of the organization Laravel and is regularly updated with great contributions from the community and the maintainers

Adding Laravel Homestead as a Dependency for The Laravel Project

Take some notes of an additional step to follow if you are using Laravel 6.0

Laravel 6 additional step

Through a file called Homestead.yaml, within the project, you can easily configure the main features of Homestead, such as IP address, database name, project location, the amount of memory and CPUs, and others.

Preparing and Configuring Laravel Homestead

To use the virtual domain assigned to the Homestead virtual machine is necessary to indicate to our system, where to send the requests, once we try to access the chosen domain (

Adding the Virtual Domain on The System

During this class, you will know the main commands needed to manage your virtual machine with Vagrant. Commands for creating, destroying, starting and shutting down, along with connecting through SSH to it. It is recommended to use Git Shell, especially on Windows, for the SSH connection.

Using Vagrant to Manage the Laravel Homestead Virtual Machine

Connected to your virtual machine, using vagrant ssh, find out how to get out easily.

Exercise Find out how to go out from the Virtual Machine
1 question

Find out how Composer can be used to keep the project dependencies up-to-date, without running the risk of introducing changes that break the correct operation of the project.

Keep The Laravel Project Updated
+ Configuring and Using Sublime Text 3 to Develop the RESTful API with Laravel
6 lectures 15:13

Package control is the initial step that opens the door to a vast world of packages and plugins for Sublime. Using package control, you can install all packages available for Sublime Text.

Installing the Package Control

Learn how to create and manage your projects with Sublime Text 3, so you can keep your development space tidy and easily access your code.

Creating and Using Projects

SublimeCodeIntel is a standalone tool for Sublime Text that facilitates browsing through the definition of different classes, methods, and variables of the project, as well as the internal code of Laravel or other packages.

Installing and Using SublimeCodeIntel to Resolve Laravel and RESTful API classes

When installing SideBarEnhencement, you can access advanced features in the sidebar, such as advanced search, creation, deletion, file management, and much more.

Installing and Using SideBarEnhancement

Through SublimeLinter for PHP, you can quickly detect errors in the code, thus helping a more reliable and fast development process.

Installing and Using SublimeLinter for PHP

With PHPCompanion, you get access to multiple functionalities among which, the possibility of automatically resolving the location of the definitions that have the sentences "use" of your project. Avoiding having to access them manually or have to memorize them.

Installing and Using PHPCompanion to Auto-import Laravel Definitions
+ Understanding the Case Study for the RESTful API
2 lectures 07:42

Let's go one by one with the different models/entities/resources that will conform the RESTful API, its attributes names, characteristics, and relationships between them.

Preview 04:14

End-Points are all possible routes or URLs that the API will provide to bring different options, resources, and utilities. During this class you will see a complete list of all of these, how every end-point work, their names, actions, methods/verbs and some more details.

Understanding the Main End-Points for the RESTful API
+ Discovering and Configuring the Laravel Structure for the RESTful API
4 lectures 19:25

During this class, you will be able to familiarize yourself with the fundamental components of Laravel, the location of the most elemental elements such as models, views, controllers, and much more.

Discovering the Laravel Structure

PHP Artisan is one of the attractions of Laravel. It allows generating code, along with direct interaction with the application from simple console commands. During this class, you will see how to access the list of PHP Artisan commands, how to get specific help for any command and more.

Discovering the Laravel PHP Artisan Commands

Environment variables are values that should usually change between one environment and another, for example, access to the database is surely different on your local computer than on your production server. In this class, you will see How these variables work, where they are located and how they are used from the different Laravel configuration files.

Configuring the Laravel Environment Variables

During this class, you will see the main changes that the route system has undergone in the most recent versions of Laravel and how you can now correctly separate your routes according to the type of application you are developing.

Understanding the Laravel Routes System for RESTful APIs
+ Creating the Initial Laravel Components for the RESTful API
4 lectures 17:11

We are about to start with the code, and it is possible that errors may arise along the classes. Find a good way to solve common mistakes and have an excellent guide to the original source code of the project.

How to Solve Common Errors During the Development of the RESTful API

During this class, you will see how to generate the initial structure of the models of the system, along with their migrations through the use of PHP artisan commands. Remember that the order of the migrations is crucial, so you must pay attention to the order in which each model is created with its respective migrations.

Preview 04:44

As in the previous class, it is also possible to create the initial structure of the controllers using PHP artisan commands. During this class, you will see the creation of resource controllers that allows implementing the CRUD operations for every resource.

Creating an Initial Laravel Structure for The Controllers

As with resource drivers, resource type paths also exist. As expected, these routes make it easy to link a given URL and resource with a particular action of a controller. You will see how some paths only use a small set of methods, but not all of them.

Creating Some End-Point for the RESTful API Using Laravel Resource Routes
+ Implementing the RESTful API Models and its Relationships using Laravel Eloquent
5 lectures 18:27

During this class, you will add the properties of the Category model, indicating which of those can be assigned massively with the $fillable attribute.

Implementing The Properties for Category

During this class you will add the properties of the Product model, indicating which of the attributes of this model are $fillable, along with those that should be hidden

Implementing The Properties for Product

During this class, you will add the properties for the Transaction model, indicating once again which of the attributes of this model can be assigned massively with the $fillable attribute.

Implementing The Properties for Transaction

During this class, you will complete the list of fillable attributes according to the design of the API, along with the attributes that will have to be hidden.

Implementing The Properties for User

In this class, you can build the different relationships between models. You can, mainly, learn the relationships "one to many" and "many to many," along with the importance of the location of the foreign key in the models.

Implementing The Relationships Between Models
+ Creating the Database Structure Using Migrations from Laravel
6 lectures 14:39

From Laravel 5.4 the charset of the database was changed by utf8-mb4, making it heavier than normal. This change causes some inconsistencies with some previous versions of MySQL and MariaDB for which it is necessary to implement a solution.

Solving a Common Issue with the Laravel Migrations

In this class, you will add all the attributes required for the "users" table. That can be done, implementing a migration for this table.

Implementing The Migration for Users

In this class, you will add the attributes that make up table categories, according to the design of the API.

Implementing The Migration for Categories

In this class, you will add the attributes that make table products, according to the design of the API using migrations.

Implementing The Migration for Products

In this class, you will add all attributes required for the transactions table. Which you can do programmatically through a migration for this table.

Implementing The Migration for Transactions

To solve the many-to-many relationship between product and category, you need to create a pivot table. Note that the order in the name of this migration is very important.

Creating the Migration for The Pivot Table
+ Creating the Laravel Factories for Database Seeding
6 lectures 24:44

Through the factories, it is possible to automatically generate fake instances of the models (generated with Faker). In this class, you will see how to build the factory to instances of User.

Creating The Laravel Factory for User

Build the factory for the category model and thus be able to generate instances automatically.

Creating The Factory for Category

Build product instances, based on fake data, through the factory.

Creating The Factory for Product

Automatically create instances of Transaction implementing this factory.

Creating The Factory for Transaction

Once the factories are created, it is necessary to use them from the DatabaseSeeder, to indicate the order in which they will be executed and the number of instances to create for each model.

Using The Factories from The DatabaseSeeder of Laravel

Once you have created the factories and the seeder that use those, it is time to execute the whole process, using a PHP artisan command. On the way, you will see how to solve some errors that were committed in the process.

Executing The Migrations and Seeder using Artisan from Laravel
  • Very recommended a fundamental domain of Object Oriented Programming
  • Fundamental knowledge about PHP (classes, functions, methods, traits, inheritance)

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 4.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.

Who this course is for:
  • This course is for all web development and PHP lovers
  • This course is for all those who need to develop their own API completely RESTful
  • If you want to build your own fully functional and step-by-step RESTful API
  • If you need to keep your skills up to date and be competitive
  • If you want to do a complete development of your projects and your RESTful API with Laravel