Simple Laravel API Boilerplate to create a ready-to-use REST API using Laravel Passport
usamamuneerchaudhary/laravel-api-boilerplate is a Laravel package for simple laravel api boilerplate to create a ready-to-use rest api using laravel passport.
It currently has 7 GitHub stars and 9 downloads on Packagist (latest version 1.2).
Install it with composer require usamamuneerchaudhary/laravel-api-boilerplate.
Discover more Laravel packages by usamamuneerchaudhary
or browse all Laravel packages to compare alternatives.
Last updated
Laravel API Boilerplate is a starting point for your first API.
It is built on top of:
run composer create-project usamamuneerchaudhary/laravel-api-boilerplate myfirstApi;
Rename .env.example to .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, run php artisan migrate --seed. You can see more info in database\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.
v7.3 or greater.You can find Authentication Controllers under namespace App\Http\Controllers\API\Auth.
There are also the validation rules for every action (login, sign up, recovery and reset) under namespace App\Http \Request\API\Auth.
POST api/v1/loginPOST api/v1/registerPOST api/v1/recoverPOST api/v1/resetGET api/v1/reset/{token}GET api/v1/logoutapi/v1/user/verify/email/{token}Please note that, api routes are prefixed with v1, you can changed this in App\Providers\RouteServiceProvider.php
All the API routes can be found in the routes/api.php file.
We're using akaunting/firewall to secure our API.
Simpler way of assigning Roles & Permissions to Users. You can more details on what we've done here on usamamuneerchaudhary/roles-permissions
A Simple CRUD Scaffolding package is being setup out of the box to keep you going without any hassle.
You can create your endpoints in routes/api.php under auth:api middleware group.
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.
This project is open-sourced software licensed under the MIT license.