The comprehensive guide to creating a truly RESTful API with Laravel
This course makes use of the latest version of Laravel! Laravel 5.4
You will not find a Laravel course like this anywhere else. This course explains everything you need to develop a RESTful API using Laravel framework
Do not wait more to become a master in the development of truly RESTful APIs with Laravel. Join the course now and see you in class
In this course, you learn how to develop a realistic, fully implemented, and professional RESTful API Laravel; you will use Laravel 5.4 for PHP
The upgrading to Laravel 5.5, will come on Octuber :)
Laravel is the most popular PHP framework, with more than 20 million downloads along with lots of enterprise and personal projects worldwide. Additionally, includes fantastic features to easily implement a RESTful API. Laravel is RESTful friendly
What is a RESTful API?
An Wbb API is like a web service which works entirely with HTTP. A RESTful API must follow the REST (REpresentationas State Transfer) practices, allowing to orientate the design to the resources, providing standard responses based on the different status codes HTTP provide and provide according Hypermedia in responses.
Because Laravel is a framework made by programmers for programmers, expressive, simple, intuitive and powerful. Laravel provide useful features for web projects including RESTful APIs.
Each new Laravel version includes many changes that make this framework ever better, simpler, 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 developing 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:
You can take a look at the full list of contents below.
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.
Learn more about the instructor, his experience and knowledge, and the motivations for the creation of this course.
First fundamental topics about RESTful APIs and how to take advantage of the different contents depending of your skills.
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
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.
Virtual Box is a very popular Oracle project for hardware virtualization, allowing the creation of virtual machines of any kind within your system.
Vagrant is a project that will help you to manage virtual machines completely configured and prepared for different tasks within Virtual Box.
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.
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
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.
During this class you will learn how to get the initial basic structure of any Laravel project, 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
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.
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 (restfulapi.dev)
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.
Connected to your virtual machine, using vagrant ssh, find out how to get out easily.
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.
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.
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.
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.
When installing SideBarEnhencement, you can access advanced features in the sidebar, such as advanced search, creation, deletion, file management, and much more.
Through SublimeLinter for PHP, you can quickly detect errors in the code, thus helping a more reliable and fast development process.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
During this class, you will add the properties of the Category model, indicating which of those can be assigned massively with the $fillable attribute.
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
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.
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.
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.
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.
In this class, you will add all the attributes required for the "users" table. That can be done, implementing a migration for this table.
In this class, you will add the attributes that make up table categories, according to the design of the API.
In this class, you will add the attributes that make table products, according to the design of the API using migrations.
In this class, you will add all attributes required for the transactions table. Which you can do programmatically through a migration for this table.
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.
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.
Build the factory for the category model and thus be able to generate instances automatically.
Build product instances, based on fake data, through the factory.
Automatically create instances of Transaction implementing this factory.
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.
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.
I enjoy transmitting knowledge and skills to people through classes and contents, in fact, I am the owner and creator of programarya, an Spanish web site to teach programming fundamentals, and of course, I have several premium contents about programming and web development in general, as well.
I continually work on improving my speech, looking for the best way to reach out the students with the central concepts and skills, I love easy but effective ways to transmit every single idea.
I appreciate every minute developing, especially when I can use my skills to implement projects that can help other developers to learn and to make their job and lives easier.
I am constantly looking to work in new projects to leverage my skills and improving the lives of people with more facilities to share the experiences and findings with my students then.
I am excited to contribute to a better world teaching people new skills and, in the way, learn through the experiences and issues of them to improve our skills together.