PHPackages                             d4nd3v/auth - 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. d4nd3v/auth

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

d4nd3v/auth
===========

Laravel 5 Auth Generator

0151PHP

Since Aug 11Pushed 8y agoCompare

[ Source](https://github.com/d4nd3v/auth)[ Packagist](https://packagist.org/packages/d4nd3v/auth)[ RSS](/packages/d4nd3v-auth/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel 5 Auth Generator (Web &amp; API)
========================================

[](#laravel-5-auth-generator-web--api)

Usage
-----

[](#usage)

### Install Through Composer

[](#install-through-composer)

```
composer require d4nd3v/auth:dev-master

```

### Add the Service Provider

[](#add-the-service-provider)

Add the provider in `app/Providers/AppServiceProvider.php`

```
public function register()
{
    ...
	if ($this->app->environment() !== 'production') {
		$this->app->register('D4nd3v\Auth\AuthServiceProvider');
	}
}
```

### Generate Auth

[](#generate-auth)

`php artisan generate:auth`

### Create Tables

[](#create-tables)

```
php artisan migrate --path=/database/migrations/auth/

```

This will create `users`, `password_resets` and `activations` tables.

### If you use API Auth:

[](#if-you-use-api-auth)

In header must be set: Accept: application/json

### Set the Model:

[](#set-the-model)

Go to `config/auth.php` and change `App\User:class` to `App\Models\User::class`.

### Routes

[](#routes)

For `'middleware' => 'guest'`, in `\app\Http\Middleware\RedirectIfAuthenticated.php` set `return redirect(route('home'));`

Web routes

```
    Route::group(['middleware' => 'guest'], function () {

        Route::get('register', 'AuthController@showRegisterForm')->name('registerForm');
        Route::post('register', 'AuthController@register')->name('register');

        Route::get('login', 'AuthController@showLoginForm')->name('loginForm');
        Route::post('login', 'AuthController@authenticate')->name('login');

    });

    Route::get('account/activate/', 'AuthController@showActivateMessage')->name('activate');
    Route::get('account/activate/{token}', 'AuthController@activate');

    Route::get('account/reactivate/', 'AuthController@showResendActivationCode')->name('reactivateForm');
    Route::post('account/reactivate/', 'AuthController@resendActivationCode')->name('reactivate');

    Route::get('logout', 'AuthController@logout')->name('logout');

    Route::get('password/reset', 'AuthController@showLinkRequestForm');
    Route::post('password/email', 'AuthController@sendEmailWithResetPasswordLink');
    Route::get('password/reset/{token}', 'AuthController@showResetForm')->name('password.reset');
    Route::post('password/reset', 'AuthController@resetPassword');

    Route::group(['middleware' => 'auth'], function () {
        Route::get('password/change', 'AuthController@showChangePasswordForm')->name('showChangePasswordForm');
        Route::post('password/change', 'AuthController@changePassword')->name('changePassword');
    });

```

API route

```
    Route::post('login', 'AuthController@authenticate');
    Route::get('logout', 'AuthController@logout');
    Route::post('register', 'AuthController@register');
    Route::post('password/forgot', 'AuthController@sendEmailWithResetPasswordLink');
    Route::post('password/reset', 'AuthController@resetPassword');
    Route::post('activate/send', 'AuthController@resendActivationCode');
    Route::group(['middleware' => 'auth.jwt'], function () {
        Route::post('password/change', 'AuthController@changePassword');
    });

```

### API Exceptions

[](#api-exceptions)

In `\app\Exceptions\Handler.php`

```
.....
public function render($request, Exception $exception)
{
    if ($exception instanceof APIException) {
        return $exception->apiExceptionResponse;
    }
.....
protected function unauthenticated($request, AuthenticationException $exception)
{
    if ($request->expectsJson()) {
        throw new ApiException("unauthenticated");
    }
.....

```

Flow:
-----

[](#flow)

```

> Register (/register)
    > ActivateAccount Notification (Send Mail)
        > Activate (From Mail) (GET /account/activate/token)

> Forgot password? (GET /password/reset)
        > PasswordReset Notification (Send Mail)
            > Change password form (From Mail) (GET /password/reset/token)
                > Action change password (/password/reset)

> Login Form (GET /login)
    > Login (POST /login)
        > Form Resend activation code   (GET /account/reactivate/)
            > Action Resend activation code   (POST /account/reactivate/)
    > Change Password (GET /password/change)
        > Set New Password (POST /password/change)

> Logout (GET /logout)

```

Utile
-----

[](#utile)

```
Test users:
test@test.test

```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

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

---

Top Contributors

[![d4nd3v](https://avatars.githubusercontent.com/u/21173540?v=4)](https://github.com/d4nd3v "d4nd3v (33 commits)")

### Embed Badge

![Health badge](/badges/d4nd3v-auth/health.svg)

```
[![Health](https://phpackages.com/badges/d4nd3v-auth/health.svg)](https://phpackages.com/packages/d4nd3v-auth)
```

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

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