In this tutorial, I’m going to show you how to build Laravel RESTful API with authentication using the passport. We are going to use Laravel’s API resources to build RESTful API. We will create Login, Register and Book CRUD API...
Build Laravel 5.8 RESTful API CRUD With Authentication Using Passport
- Install Laravel and Basic Configurations
- Install Passport Package
- Migrate and Install Passport
- Passport Configuration
- Create Book Table
- Create Model and Controllers
- Create API Routes
- Call API using Postman
Register API: Verb: POST, URL: http://laravel_api.test/api/register
Login API: Verb: POST, URL: http://laravel_api.test/api/login
Create Book API: Verb: POST, URL: http://laravel_api.test/api/books
All Books API: Verb: GET, URL: http://laravel_api.test/api/books
Show Single Book API: Verb: GET, URL: http://laravel_api.test/api/books/1
Update Book API: Verb: PUT, URL: http://laravel_api.test/api/books/1
Delete Book API: Verb: DELETE, URL: http://laravel_api.test/api/books/1
You can download the project, modify the code and use it anywhere you want without re-posting to your blog. Happy Coding :)
Thank you.