A RESTful API is an application program interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data. It is an architectural style and approach to communications often used in web services development. REST API helps us to do Web and Mobile Development simultaneously by helping us connect database and do operations.
These APIs communicate with the application through endpoints. Let's say for example www.restapisample.com/users gives details of all users. This endpoint can be used in any web application or mobile application to achieve the task of displaying users.
So today we will develop REST API in Laravel 5.7
Composer is a dependency manager for PHP like Pip is for python. Here we will use composer to install laravel project and its dependency. To install composer visit https://getcomposer.org/download/
First, download the Laravel installer using Composer.
composer global require "laravel/installer"
Once installed, the laravel new command will create a fresh Laravel installation in the directory you specify. For instance, laravel new RestApi will create a directory named RestApi containing a fresh Laravel installation with all of Laravel’s dependencies already installed.
laravel new RestApi
To check what is the version of the project installed, you can use the command.
php artisan --version