PHPackages                             jeroen-g/laravel-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. jeroen-g/laravel-auth

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

jeroen-g/laravel-auth
=====================

A simple extension of laravel's authentication.

v1.0-beta(12y ago)62284EUPL-1.1PHPPHP &gt;=5.3.0

Since Mar 10Pushed 11y ago1 watchersCompare

[ Source](https://github.com/Jeroen-G/laravel-auth)[ Packagist](https://packagist.org/packages/jeroen-g/laravel-auth)[ RSS](/packages/jeroen-g-laravel-auth/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)Dependencies (3)Versions (3)Used By (0)

Auth
====

[](#auth)

#### *Just another authentication package for Laravel.*

[](#just-another-authentication-package-for-laravel)

[![Build Status](https://camo.githubusercontent.com/28b72a44f8bd0619ced07f2473d614a237904c30323224dd208ccc2936f67692/68747470733a2f2f7472617669732d63692e6f72672f4a65726f656e2d472f6c61726176656c2d617574682e706e67)](https://travis-ci.org/Jeroen-G/laravel-auth)[![Scrutinizer Quality Score](https://camo.githubusercontent.com/f9428439c296aeff95ccffb2987c3e8950cb30805083af59079de6b026cabe9c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4a65726f656e2d472f6c61726176656c2d617574682f6261646765732f7175616c6974792d73636f72652e706e673f733d62363130373732346136643637306462633737313738653932383364643436653032623161623035)](https://scrutinizer-ci.com/g/Jeroen-G/laravel-auth/)[![Latest Stable Version](https://camo.githubusercontent.com/cf753480e2c69215347baba23cde6c9270c861207311d1ab057141a26970a2f8/68747470733a2f2f706f7365722e707567782e6f72672f6a65726f656e2d672f6c61726176656c2d617574682f762f737461626c652e706e67)](https://packagist.org/packages/jeroen-g/laravel-auth)

---

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

[](#installation)

Add this line to your `composer.json`

```
"jeroen-g/laravel-auth": "dev-master"

```

Then update Composer

```
composer update

```

Add the service provider in `app/config/app.php`:

```
'JeroenG\LaravelAuth\LaravelAuthServiceProvider',

```

The last thing to do is to migrate to create the tables for the users, roles and permissions

```
php artisan migrate --package="jeroen-g/laravel-auth"

```

Usage
-----

[](#usage)

### Check if the user has a permission

[](#check-if-the-user-has-a-permission)

```
if(Auth::can('edit'))
{
	// show a form to edit stuff.
}
```

### Check if the user has a role

[](#check-if-the-user-has-a-role)

```
if(Auth::is('Moderator'))
{
	// Show a form to edit stuff, if the 'Moderator' role has the 'edit' permission.
}
```

### Check if the user is an admin

[](#check-if-the-user-is-an-admin)

To use this function, make sure to give a user the 'Admin' role.

```
Auth::isAdmin();
```

You could for example use this to create a filter that protects your backend.

```
Route::filter('auth.admin', function()
{
	if ( ! Auth::isAdmin()) return Redirect::to('login');
});
```

### Getting all of the available roles/permissions/users

[](#getting-all-of-the-available-rolespermissionsusers)

```
Auth::allRoles();

Auth::allPermissions();

Auth::allUsers();

//Example of both optional parameter
Auth::allUsers('json', true);
```

Both accept two optional parameters, which is the format of the returned results: array, object or json. By default an array is returned. The second is a boolean, set this to true if you want to include trashed items.

### Assigning a role/permission to a user

[](#assigning-a-rolepermission-to-a-user)

```
Auth::giveRole('Member', 2);

Auth::givePermission('edit', 2);
```

In both cases the second parameter is the user id. This is optional, if none is passed, the id of the logged in user is used.

### Assiging a permission to a role

[](#assiging-a-permission-to-a-role)

```
Auth::giveRolePermission('edit', 'Admin');
```

The first parameter is the permission, the second the role. To find out if a role has a certain permission, you could use the `roleCan()` function.

```
Auth::roleCan('Admin', 'edit');
```

### Removing a role/permission from a user/role

[](#removing-a-rolepermission-from-a-userrole)

```
Auth::takeRole('Member', 2);

Auth::takePermission('edit', 2);

Auth::takeRolePermission('edit', 'Admin');
```

### Check if a role/permission/user exists

[](#check-if-a-rolepermissionuser-exists)

```
Auth::roleExists('Admin');

Auth::permissionExists('edit');

Auth::userExists(2);
```

All three functions accept a second parameter, `true` or `false`, which determines if the trashed entries will also be used (trashed entries are soft-deleted from the database, see below).

### Adding a new role/permission/user

[](#adding-a-new-rolepermissionuser)

```
// Name, description, level (any number)
Auth::addRole('Admin', 'One Role To Rule Them All', 10);

// Name, description
Auth::addPermission('edit', 'Ability to edit stuff');

// Username, password, email
Auth::addUser('Jeroen', 'password123', 'jeroen@example.com');
```

### Delete a role/permission/user

[](#delete-a-rolepermissionuser)

```
Auth::deleteRole('Moderator');

Auth::deletePermission('edit', true);

Auth::deleteUser(2);
```

A second parameter is accepted on all three functions. This boolean states if the entry (role/perm/user) should be deleted with force (default set to false). Soft-deleted (so not with force) will be left out of every request to the database (unless otherwise stated). They can however be restored.

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity45

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4494d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/41971?v=4)[Jeroen Goudsmit](/maintainers/JeroenG)[@jeroeng](https://github.com/jeroeng)

---

Top Contributors

[![Jeroen-G](https://avatars.githubusercontent.com/u/1116853?v=4)](https://github.com/Jeroen-G "Jeroen-G (40 commits)")

---

Tags

laravelauthAuthenticationloginUsers

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jeroen-g-laravel-auth/health.svg)

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

###  Alternatives

[auth0/login

Auth0 Laravel SDK. Straight-forward and tested methods for implementing authentication, and accessing Auth0's Management API endpoints.

2745.2M3](/packages/auth0-login)[php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

83910.6M60](/packages/php-open-source-saver-jwt-auth)[hasinhayder/tyro-login

Tyro Login - Beautiful, customizable authentication views for Laravel 12 &amp; 13

2453.7k5](/packages/hasinhayder-tyro-login)[sarav/laravel-multiauth

A Simple Laravel Package for handling multiple authentication

5030.9k](/packages/sarav-laravel-multiauth)[alajusticia/laravel-logins

Session management in Laravel apps, user notifications on new access, support for multiple separate remember tokens, IP geolocation, User-Agent parser

2013.2k](/packages/alajusticia-laravel-logins)

PHPackages © 2026

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