Laravel makes API authentication a breeze using Laravel Passport, which provides a full OAuth2 server implementation for your Laravel application in a matter of minutes. If you are new to Laravel, I suggest you go through this article first to learn how to set up and create a new project.
In your laravel project, run the command and then run migrate command to create all the necessary tables. This command will create the encryption keys needed to generate secure access tokens.
Run the following command to create a controller, We shall create this inside a new namespace for the Api, so that all your API controllers can be separate for cleaner architecture.