PHPackages                             lvlup-dev/laravel-user-is-admin - 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. lvlup-dev/laravel-user-is-admin

ActiveLaravel-package[Authentication &amp; Authorization](/categories/authentication)

lvlup-dev/laravel-user-is-admin
===============================

Laravel package that adds an is\_admin column to the users table and provides a middleware to protect admin-only routes.

v1.1.0(1mo ago)01↑2900%MITPHPPHP ^8.2

Since Mar 29Pushed 1mo agoCompare

[ Source](https://github.com/lvlup-dev/laravel-user-is-admin)[ Packagist](https://packagist.org/packages/lvlup-dev/laravel-user-is-admin)[ Docs](https://www.lvlup.fr)[ RSS](/packages/lvlup-dev-laravel-user-is-admin/feed)WikiDiscussions main Synced 1mo ago

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

Laravel User Is Admin
=====================

[](#laravel-user-is-admin)

[![Latest Version on Packagist](https://camo.githubusercontent.com/49522fc186dc6409d54d5b19a37a9af0e658fe436cb1fa15b6c8538e5b6cbfc6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c766c75702d6465762f6c61726176656c2d757365722d69732d61646d696e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lvlup-dev/laravel-user-is-admin)[![MIT Licensed](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

Add a boolean `is_admin` column on your `users` table and protect routes with a single `admin` middleware. No roles, no permissions table—just enough for a simple “is this user an administrator?” check.

Quick example
-------------

[](#quick-example)

```
// routes/web.php
Route::middleware(['auth', 'admin'])->group(function () {
    Route::get('/admin/dashboard', AdminDashboardController::class);
});
```

Unauthenticated users get Laravel’s usual `AuthenticationException`; authenticated non-admins get `403` (`AccessDeniedHttpException`).

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

[](#installation)

You can install the package via composer:

```
composer require lvlup-dev/laravel-user-is-admin
```

Run migrations (the package registers its migration automatically):

```
php artisan migrate
```

Note : The service provider registers the middleware alias `admin` for `LvlupDev\UserIsAdmin\Http\Middleware\EnsureUserIsAdmin`.

Protecting Routes
-----------------

[](#protecting-routes)

You can use the `admin` middleware to protect your routes. Unauthenticated users will trigger Laravel’s usual `AuthenticationException`, while authenticated non-admins will get a 403 (`AccessDeniedHttpException`).

```
// routes/web.php
Route::middleware(['auth', 'admin'])->group(function () {
    Route::get('/admin/dashboard', AdminDashboardController::class);
});
```

Granting Admin Rights
---------------------

[](#granting-admin-rights)

This package does **not** ship a custom `User` model - you keep yours. To grant admin privileges, simply update the `is_admin` column.

```
$user->is_admin = true;
$user->save();
```

Or via a mass update:

```
User::query()->whereKey($id)->update(['is_admin' => true]);
```

Alternatives
------------

[](#alternatives)

**`laravel-user-is-admin` is intentionally minimal:** one column, one middleware, no UI and no concept of roles or fine-grained permissions.

If you need roles, permissions, teams, Blade directives, Gates, and a full permission layer, use **[Spatie Laravel Permission](https://spatie.be/docs/laravel-permission/v7/introduction)** instead—it is the standard choice for richer authorization in Laravel apps.

Read [this blog post (in French)](https://www.lvlup.fr/blog/package-laravel-user-is-admin) on why we prefer this pragmatic approach for MVPs.

Credits
-------

[](#credits)

**laravel-user-is-admin** is built and maintained by [LVLUP](https://www.lvlup.fr). We help businesses drive operational efficiency through strategic consulting, tailored software development, and advanced AI Agent integrations. Check out our website for more tutorials and resources.

License
-------

[](#license)

The MIT License (MIT). Please see [LICENSE](LICENSE) for more information.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance90

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

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

Every ~0 days

Total

2

Last Release

46d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/91f10f8dfd1c4cad561f5c61e01b91f0820c2d08e9c67c8d092b8613bf40752b?d=identicon)[dsampaolo](/maintainers/dsampaolo)

---

Top Contributors

[![dsampaolo](https://avatars.githubusercontent.com/u/1384803?v=4)](https://github.com/dsampaolo "dsampaolo (2 commits)")

---

Tags

middlewarelaravelsecurityauthorizationadminrole

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/lvlup-dev-laravel-user-is-admin/health.svg)

```
[![Health](https://phpackages.com/badges/lvlup-dev-laravel-user-is-admin/health.svg)](https://phpackages.com/packages/lvlup-dev-laravel-user-is-admin)
```

###  Alternatives

[tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

11.5k49.1M350](/packages/tymon-jwt-auth)[php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

8359.8M53](/packages/php-open-source-saver-jwt-auth)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[alajusticia/laravel-logins

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

2011.0k](/packages/alajusticia-laravel-logins)[hosseinhezami/laravel-permission-manager

Advanced permission manager for Laravel.

403.3k](/packages/hosseinhezami-laravel-permission-manager)

PHPackages © 2026

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