Best laravel framework open-source packages.

Laravel Passport Token Based Authentication

A simple Laravel API boilerplate equipped with Passport token based authentication.

Installation

To install the dependencies, navigate to the project's root directory and run:

composer install

Copy the contents of .env.example to a .env file, or simply run this command:

# Linux
cp .env.example .env
# Windows
copy .env.example .env

Configure the environment variables on the .env file then generate the application key by running:

php artisan key:generate

To the run the migrations, execute the migrate command:

php artisan migrate

Create Passport personal access clients using this command:

php artisan passport:install

API Endpoints

Method Path Description
POST api/auth/register Register a new account
POST api/auth/login Login to an existing account
GET api/auth/user Fetch the authenticated user

Postman Collection

Published documentation of the Postman collection can be found here. You can run the collection by clicking the ► Run in Postman button on the documentation page. The Development environment must be set as the active environment.

Environment Variable Description
server Must be manually set with the application's URL
token Automatically set after a successful login