PHPackages                             muhammadshakeel/laravel-api-boilerplate-oauth - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. muhammadshakeel/laravel-api-boilerplate-oauth

ActiveProject[Authentication &amp; Authorization](/categories/authentication)

muhammadshakeel/laravel-api-boilerplate-oauth
=============================================

A RESTful API starter pack for Laravel 5 with OAuth2.

v1.0.3(10y ago)15954MITPHPPHP &gt;=5.5.9

Since Jan 15Pushed 10y ago2 watchersCompare

[ Source](https://github.com/muhammadshakeel/laravel-api-boilerplate-oauth)[ Packagist](https://packagist.org/packages/muhammadshakeel/laravel-api-boilerplate-oauth)[ RSS](/packages/muhammadshakeel-laravel-api-boilerplate-oauth/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (8)Versions (5)Used By (0)

Laravel API Boilerplate (OAuth2 Edition)
----------------------------------------

[](#laravel-api-boilerplate-oauth2-edition)

[![Latest Stable Version](https://camo.githubusercontent.com/7ff5b6a1d6d310d70d307bcec15e6e14e0bc52887d3b2bbbaa8a04b33bbc37cb/68747470733a2f2f706f7365722e707567782e6f72672f6d7568616d6d61647368616b65656c2f6c61726176656c2d6170692d626f696c6572706c6174652d6f617574682f762f737461626c65)](https://packagist.org/packages/muhammadshakeel/laravel-api-boilerplate-oauth) [![Total Downloads](https://camo.githubusercontent.com/6a651abafd7d8eca18242ea2076753f0134e00d68f9ad504cdc7c719da4690b9/68747470733a2f2f706f7365722e707567782e6f72672f6d7568616d6d61647368616b65656c2f6c61726176656c2d6170692d626f696c6572706c6174652d6f617574682f646f776e6c6f616473)](https://packagist.org/packages/muhammadshakeel/laravel-api-boilerplate-oauth) [![Latest Unstable Version](https://camo.githubusercontent.com/6126ef044d82faff015325ce4950f8fb33d5ba34562a5eca359a8d29ce9cbc81/68747470733a2f2f706f7365722e707567782e6f72672f6d7568616d6d61647368616b65656c2f6c61726176656c2d6170692d626f696c6572706c6174652d6f617574682f762f756e737461626c65)](https://packagist.org/packages/muhammadshakeel/laravel-api-boilerplate-oauth) [![License](https://camo.githubusercontent.com/c3216fef95a63885f20d007a2ca0b344d8af4109ab1da7de54886da4f03355ba/68747470733a2f2f706f7365722e707567782e6f72672f6d7568616d6d61647368616b65656c2f6c61726176656c2d6170692d626f696c6572706c6174652d6f617574682f6c6963656e7365)](https://packagist.org/packages/muhammadshakeel/laravel-api-boilerplate-oauth)[![Codacy Badge](https://camo.githubusercontent.com/de565160d2e4dea4feb182d323271272d4aceaa0da9c775fe7b255e3dac7e93f/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f67726164652f6237623566656438613765643439383161353237366635616632313136316537)](https://www.codacy.com/app/mshakeel/laravel-api-boilerplate-oauth)

### Based on [francescomalatesta/laravel-api-boilerplate-jwt](https://github.com/francescomalatesta/laravel-api-boilerplate-jwt)

[](#based-on-francescomalatestalaravel-api-boilerplate-jwt)

Laravel API Boilerplate is a ready-to-use "starting pack" that you can use to build your first API in seconds. As you can easily imagine, it is built on top of the awesome Laravel Framework.

It also benefits from three pacakages:

- OAuth2 - [lucadegasperi/oauth2-server-laravel](https://github.com/lucadegasperi/oauth2-server-laravel)
- Dingo API - [dingo/api](https://github.com/dingo/api)

With a similar foundation is really easy to get up and running in no time. I just made an "integration" work, adding here and there something that I found useful.

Installation
------------

[](#installation)

- composer create-project muhammadshakeel/laravel-api-boilerplate-oauth your-project
- cd your-project
- php -r "copy('.env.example', '.env');"
- php artisan key:generate
- chmod -R 777 storage/ bootstrap/cache/
- php artisan vendor:publish
- php artisan migrate
- php artisan db:seed --class=ClientTableSeeder

Done!

Main Features
-------------

[](#main-features)

### A Ready-To-Use AuthController

[](#a-ready-to-use-authcontroller)

I've put an "AuthController" in *App\\Api\\V1\\Controllers*. It supports the four basic authentication/password recovery operations:

- *login()*;
- *signup()*;
- *recovery()*;
- *reset()*;

In order to work with them, you just have to make a POST request with the required data.

You will need:

- *login*: just email and password;
- *signup*: whatever you like: you can specify it in the config file;
- *recovery*: just the user email address;
- *reset*: token, email, password and password confirmation;

### A Separate File for Routes

[](#a-separate-file-for-routes)

You can specify your routes in the \*api\_routes.php\_ file, that will be automatically loaded. In this file you will find many examples of routes.

Configuration
-------------

[](#configuration)

As I already told before, this boilerplate is based on *dingo/api* and *lucadegasperi/oauth2-server-laravel* packages. So, you can find many informations about configuration [here](https://github.com/dingo/api/wiki/Configuration) and [here](https://github.com/lucadegasperi/oauth2-server-laravel/blob/master/docs/getting-started/config.md).

However, there are some extra options that I placed in a *config/boilerplate.php* file.

- **signup\_fields**: you can use this option to specify what fields you want to use to create your user;
- **signup\_fields\_rules**: you can use this option to specify the rules you want to use for the validator instance in the signup method;
- **signup\_token\_release**: if "true", an access token will be released from the signup endpoint if everything goes well. Otherwise, you will just get a *201 Created* response;
- **reset\_token\_release**: if "true", an access token will be released from the signup endpoint if everything goes well. Otherwise, you will just get a *200* response;
- **recovery\_email\_subject**: here you can specify the subject for your recovery data email;

Creating Endpoints
------------------

[](#creating-endpoints)

You can create endpoints in the same way you could to with using the single *dingo/api* package. You can [read its documentation](https://github.com/dingo/api/wiki/Creating-API-Endpoints) for details.

After all, that's just a boilerplate! :)

Notes
-----

[](#notes)

I currently removed the *VerifyCsrfToken* middleware from the *$middleware* array in *app/Http/Kernel.php* file. If you want to use it in your project, just use the route middleware *csrf* you can find, in the same class, in the *$routeMiddleware* array.

Feedback
--------

[](#feedback)

I currently made this project for personal purposes. I decided to share it here to help anyone with the same needs. If you have any feedback to improve it, feel free to make a suggestion, or open a PR!

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 51.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~12 days

Total

3

Last Release

3747d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c4b5ddbfa57d8852fc2f7f6392d2a48f757482a3661b083f38e075b72bb58864?d=identicon)[muhammadshakeel](/maintainers/muhammadshakeel)

---

Top Contributors

[![muhammadshakeel](https://avatars.githubusercontent.com/u/4094268?v=4)](https://github.com/muhammadshakeel "muhammadshakeel (14 commits)")[![francescomalatesta](https://avatars.githubusercontent.com/u/1940952?v=4)](https://github.com/francescomalatesta "francescomalatesta (11 commits)")[![vikkio88](https://avatars.githubusercontent.com/u/248805?v=4)](https://github.com/vikkio88 "vikkio88 (2 commits)")

---

Tags

apilaravelserveroauthoauth2restfuldingo

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/muhammadshakeel-laravel-api-boilerplate-oauth/health.svg)

```
[![Health](https://phpackages.com/badges/muhammadshakeel-laravel-api-boilerplate-oauth/health.svg)](https://phpackages.com/packages/muhammadshakeel-laravel-api-boilerplate-oauth)
```

###  Alternatives

[league/oauth2-server

A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.

6.6k136.0M248](/packages/league-oauth2-server)[chervand/yii2-oauth2-server

OAuth 2.0 server for Yii 2.0 with MAC tokens support.

1524.2k1](/packages/chervand-yii2-oauth2-server)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
