Create Fast RESTful APIs with Lumen and Homestead by Laravel

Lumen, a micro-framework by Laravel, is the best way for faster RESTful APIs. Create a RESTful API with Lumen/Homestead
4.1 (89 ratings)
Instead of using a simple lifetime average, Udemy calculates a
course's star rating by considering a number of different factors
such as the number of ratings, the age of ratings, and the
likelihood of fraudulent ratings.
1,071 students enrolled
75% off
Take This Course
  • Lectures 31
  • Length 3 hours
  • Skill Level All Levels
  • Languages English
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion
Wishlisted Wishlist

How taking a course works


Find online courses made by experts from around the world.


Take your courses with you and learn anywhere, anytime.


Learn and practice real-world skills and achieve your goals.

About This Course

Published 10/2015 English

Course Description

Create an agile and fast RESTful API with Lumen from scratch and step-by-step

This course has classes about all the recent Lumen versions (5.1 and 5.2)!

In this course you are going to learn to develop a professional and fully functional RESTful APIs using Lumen, the micro-framework based on Laravel.

Lumen is a micro-framework for PHP based on laravel, combining the most highlighted features of laravel in a much lighter and faster version.

Why Lumen?

Lumen has the best features of Laravel in a more light and quick version , while remaining expressive, intuitive, powerful and especially simple .

With Lumen your API will support at least twelve hundred (1200) requests in a range of 10 seconds with 10 simultaneous requests. This great speed makes it the perfect candidate for implementing a RESTful API in it, and the best, it is completely easy!

Millions of programmers of PHP use Laravel and all of them are agree with the incredible ease and agility that Lumen provides for micro services, including of course, RESTful APIs, so, what are you waiting for? Take it now!

Lumen for PHP have been included new concepts and facilities, similar to Laravel allowing you to create fast, agile but powerful RESTful API easily.

You are going to obtain this specific knoledge and skills during the course:

  • Major differences and facilities of Lumen VS Laravel
  • Creating a development environment with Homestead
  • Interaction with Vagrant virtual machines
  • Configure Homestead with Vagrant virtual sites
  • Configure and use the code editor Sublime Text 3
  • Using PHP artisan for creating code
  • Global Middlewares and route middleware
  • Create models
  • Relationships one to many between models (1: N)
  • Relationships many to many between models (N: N)
  • Tables intermediary or pivot
  • Validation of requests
  • Management and control of exceptions and errors
  • Migrations (automatic creation of databases)
  • Seeds (Automatic Insertion databases)
  • Factories , to create test/fake data
  • Creating a server OAuth 2
  • Generate access_token
  • Resource protection with access token
  • Restrict access through access token
  • Improving framework for production
  • Interaction with the database through Eloquent
  • Much, much more.

During the course will create a RESTful API from scratch , following the REST architecture and the proper construction of URLs to identify actions and resources using the controllers and routes for resources on Lumen.

Hone the characteristics of your work tools ( Sublime Text 3, Git shell, Lumen, Composer, artisan PHP ) and improve your productivity for development agile.

Learn to develop a local project on Windows with Homestead , how to interact with the virtual machine Vagrant , with the operative system Ubuntu through a connection ssh .

You'll see how to use Lumen through the console PHP artisan to build agile a RESTful API that responds to methods of HTTP ( GET, POST, PUT, and DELETE PATCH ), also populate the database structure and build an automated manner.

It does not end there! Will have access for life for the additional classes that are constantly be adding to the course.

Upon completion of this course you will be able to develop your own RESTful API with Lumen and PHP and including micro-services, in a quick and simple way, exploiting the facilities provided by this micro-framework for the proper and adequate implementation of your projects.

Do not wait to be proficient in PHP and RESTful. Join the course and see you in class

What are the requirements?

  • PHP Programming (basic knowledge its enough)
  • Basic OOP knowledge (classes, functions)

What am I going to get from this course?

  • Domain the most recent tools for web development
  • Use light and agile tools to professional web projects
  • Development of high complexity projects, in few time
  • Deeper and professional knowledge about web development with PHP

Who is the target audience?

  • Who likes programming and web development
  • Who want to encrease his skills to the next level
  • Who are looking for domain the most recent techniques for web development
  • Who want to be clever on web development with PHP

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.


Section 1: Starting with the Course

How to use the platform, use the resources and leave comments


Lets to know a little about me, my skills, my experience and projects.


How to take advantage of the classes, how every class and content works.


During this class you are going to discover, why Lumen is the best choise to develop a RESTful API,

Section 2: Setting the Development Environment

During this class you are going to download and install:

  • Oracle Virtual Box
  • Vagrant
  • Git/Github (Shell)
  • PHP and Composer
  • Sublime Text 3

During this class you are going to get a Lumen 5.1 instance and you are going to link it to homestead as a project dependency. It mean a Homestead instance per project.


During this class you are going to install, obtain and use Homestead.

Homestead: Is a previously created and designed box for Vagrant, wich provides a easily way to deploy and develop Laravel/Lumen projects (mainly).


During the class you are going to learn how to install the most useful add-ons to Sublime Text 3 for a faster development.

Sublime Text 3: Is a free code editor. Useful to develop projects in multiple programming languages wich includes PHP.


You'll see how Vagrant works and how to use it easily and faster.

4 questions

Let check if you know every component of your development environment

Section 3: Programming the Main Project Structure for Lumen

This course, provide you a great advantage, which allow you to follow and check the code for every content and every class. How the project evolves, what changed in every class, copy/edit easily the code.


Learn how Lumen is structured and organized. Know the main differences between Laravel and Lumen. Learn how to enable the most essencial and useful features of Lumen for a much more easy programming.


During this class you'll see how to create the models easily using php artisan and the relationship between those models (many to many and one to many).


During this class you are going to use the Lumen migrations feature to create the tables associated with every model and their attributes for the relationships. It includes the pivos table for the many to many relationship.


During this class you are going to seed the database using factories of Lumen to create fake data and test the database structure and project.


During this class you are going to create the routes to manage (create, read, update and delete) resources in the RESTful API and the required controllers to manage all the kind of requests, like this:

  • index method => Is used to show all the resources associated with the request => Uses the GET HTTP method.
  • store method => Used to store a new resource => Uses the POST HTTP method.
  • show => Used to show an specific resource (by id) => Uses the GET HTTP method.
  • update => Used to update/change a resource data => Responses to PATCH/PUT HTTP methods.
  • delete => Remove a specified resource => Responses to the DELETE HTTP method.
3 questions

Verify if you know the main components of the Lumen structure.

Section 4: Programming The Operations for Simple Resources in the RESTful API

During this class you are going to develop the functions to show data associated with the simple resrouces of the RESTful API (Teachers, Courses and Students).

The index and show method responses to the GET HTTP method.


  1. The index method show ALL the requestes resources
  2. The show method show ONLY the requested resource (if exsists)

During this class you are going to implement the method that allow you to insert simple recources (students and teachers).

Take into account that the POST method of HTTP is used to create/inser data or new resources into de database.


During the class you are going to implement the methods to update/edit existing simple resoruces.

In this case you can:

  • Edit an existing teacher.
  • Edit/update an existing student.

The method update responses to the PUT and PATCH methods of the HTTP protocol.

Notice: Due to the HTTP protocol definition, PHP and therefore Laravel, recibes values for this methods ONLY when are sent using the www-url-encode way instead of form-params.


During this class you are going to implement the method "destroy" to delete simple resources (Student and Teacher).

The destroy method response to the DELETE method of HTTP and just remove an existing resource.

PS: At the moment of delete resources, we need to be very careful with the foreign keys because a resoruce can't be deleted if another resource depends of them. For example, a teacher can't be deleted witouth remove first the associated courses (or assign a new teacher).

Section 5: Programming The Operations for Nested Resources in the RESTful API

During the class you are going to develop the method to show data about the nested resources, it means:

  1. Show the students taking a course and,
  2. Show the courses taught by a teacher

The index method responses to the GET HTTP method.


  • The index method show all the required resources.

During this lecture you are going to develop the the methods which allow you to insert or create nested resources.

In thiis case:

  • Create a course with a specific teacher
  • Add a existent student to an existent course

The store method is used to create/insert new resources into the database. The store method responses to the POST method of the HTTP protocol.


During the class you are going to develop the method to update/edit an existing nested resoruce.

In this case you can edit a specific course that is associated with a specific teacher. Remember that the students and the courses can be updated by themself methods, so the CourseStudentController does not need the update method.

The method update responses to the PUT and PATCH methods of the HTTP protocol.

Notice: Due to the HTTP protocol definition, PHP and therefore Laravel, recibes values for this methods ONLY when are sent using the www-url-encode way instead of form-params.


During the class you are going to develop the functions to remove nested resources or in specific cases to remove the relationship between them.

In this case you are going to:

  • Delete a course associated with a specifi teacher.
  • Remove a student from a specific course.

The destroy method responses to the DELETE method of the HTTP protocol and delete an element or a relationship from the database.

PS: At the moment to remove an element you have to be careful with the foreign keys because a course can not be deleted witouth remove all the relationships with the students.

Section 6: Security, Access and Requests Validation

During this lecture you are going to meet OAuth2, a mechanism to validate requests and the access to specific resoruces or operations, giving a more detailed ans specific control hover the resources.


During this section you are going to add the OAuth2 Server as a dependency of your Lumen project and then install all the required database tables, values and files for the configuration.


The OAuth2 server is almost done, you need to add a grant_type to obtain the access tokens, run the migrations and create a client to test how it is working.


During this class you are going to finally specify which routes and operations you want to protect through the OAuth2 middleware.

Def: A middleware is a mechanisms that is executed before to attend a requests, if the middleware "decide" to pass the requests all works, but if not the requests is rejected. In Lumen you can execute a middleware for every request or for a specific requests.

Section 7: Finalizing Details

Something can fail during the RESTful API execution and, for that reason is neccessary to catch all the possible failures in a firendly way and avoid unexpected behaviours.


During the development somethings lost the speed and efficiency, so it is neccessary to run som specific tasks to restore the original efficiency and works at the 100% of capacity.

2 questions

Verify if you know why are important these details

Section 8: Upgrading to Lumen 5.2
Upgrading from Lumen 5.1 to Lumen 5.2
Section 9: Thank You!

Nothing is finished yet! The course is going to have new classes along the time, new contents and of course I'm going to answer all your question and comments every time.

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

JuanD MeGon, Experienced Web Developer, Programmer and Instructor

Systems and Informatics Engineer - Web Developer

Professional Instructor. Founder of ProgramarYa.

Found professional courses about web development with high quality and availability, PHP, Laravel and Web Development in general.


Ingeniero de sistemas e informática - Desarrollador Web.

Instructor profesional y fundador de ProgramarYa.

Encuentra cursos profesionales sobre PHP, Laravel y de desarrollo web en general, con alta calidad y disponibilidad.

Ready to start learning?
Take This Course