usamamuneerchaudhary / laravel-api-boilerplate
Simple Laravel API Boilerplate to create a ready-to-use REST API using Laravel Passport
Installs: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 1
Forks: 0
Open Issues: 0
Type:project
pkg:composer/usamamuneerchaudhary/laravel-api-boilerplate
Requires
- php: ^7.3.7
- akaunting/firewall: ^1.1
- barryvdh/laravel-cors: ^0.11.3
- facade/ignition: ^1.11
- fideloper/proxy: ^4.0
- laravel/framework: ^6.0
- laravel/passport: ^7.4
- laravel/tinker: ^1.0
Requires (Dev)
- barryvdh/laravel-debugbar: ^3.2
- beyondcode/laravel-dump-server: ^1.0
- fzaninotto/faker: ^1.4
- mockery/mockery: ^1.0
- nunomaduro/collision: ^3.0
- phpunit/phpunit: ^7.5
This package is auto-updated.
Last update: 2025-10-05 20:00:19 UTC
README
Laravel API Boilerplate using Laravel Passport
Laravel API Boilerplate is a starting point for your first API.
It is built on top of:
- Laravel Framework - laravel/laravel
- Laravel Passport - laravel/passport
- Laravel-CORS barryvdh/laravel-cors
Installation
-
run
composer create-project usamamuneerchaudhary/laravel-api-boilerplate myfirstApi; -
Rename
.env.exampleto.env -
Generate Passport encryption keys & secret access tokens
php artisan passport:install -
Generate application key by
php artisan key:generate -
After DB Connection, run
php artisan migrate. For dummy data for users, runphp artisan migrate --seed. You can see more info indatabase\seeds\UserTableSeeder.php. -
For Testing Emails, you can setup MailTrap.
-
Well that's it lad, it would be up and running on your server already.
Basic Requirements for the Project
- PHP
v7.3or greater.
Main Features
Ready-To-Use Authentication Controllers
You can find Authentication Controllers under namespace App\Http\Controllers\API\Auth.
Validations
There are also the validation rules for every action (login, sign up, recovery and reset) under namespace App\Http \Request\API\Auth.
Endpoints
- Login:
POST api/v1/login - Register:
POST api/v1/register - Recover
POST api/v1/recover - Reset
POST api/v1/reset - Find Reset Token
GET api/v1/reset/{token} - Logout
GET api/v1/logout - Verify Email
api/v1/user/verify/email/{token}
Please note that, api routes are prefixed with v1, you can changed this in App\Providers\RouteServiceProvider.php
Separate File for Routes
All the API routes can be found in the routes/api.php file.
Firewall
We're using akaunting/firewall to secure our API.
Roles & Permissions
Simpler way of assigning Roles & Permissions to Users. You can more details on what we've done here on usamamuneerchaudhary/roles-permissions
CRUD Scaffolding
A Simple CRUD Scaffolding package is being setup out of the box to keep you going without any hassle.
Creating Endpoints
You can create your endpoints in routes/api.php under auth:api middleware group.
Cross Origin Resource Sharing
If you want to enable CORS for a specific route or routes group, you just have to use the cors middleware on them.
Thanks to the barryvdh/laravel-cors package, you can handle CORS easily. Just check the docs at this page for more info.
License
This project is open-sourced software licensed under the MIT license.