PHPackages                             laravilt/users - 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. laravilt/users

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

laravilt/users
==============

User and Role management plugin for Laravilt - Full RBAC system with impersonation support

1.0.2(4mo ago)0462[3 PRs](https://github.com/laravilt/users/pulls)MITPHPPHP ^8.3|^8.4CI passing

Since Dec 21Pushed 1w agoCompare

[ Source](https://github.com/laravilt/users)[ Packagist](https://packagist.org/packages/laravilt/users)[ GitHub Sponsors](https://github.com/fadymondy)[ RSS](/packages/laravilt-users/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (16)Versions (8)Used By (0)

[![Users](./arts/screenshot.jpg)](./arts/screenshot.jpg)

Laravilt Users
==============

[](#laravilt-users)

[![Latest Stable Version](https://camo.githubusercontent.com/163737b90a699cde4fe99adc22207b4b78db4aabab046e2f3aefbe29b39047f9/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176696c742f75736572732f76657273696f6e2e737667)](https://packagist.org/packages/laravilt/users)[![License](https://camo.githubusercontent.com/12cafe4cecedcd878be8e17544c303f62a1ea824b0e6e6ff7c6acdbacefdb236/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176696c742f75736572732f6c6963656e73652e737667)](https://packagist.org/packages/laravilt/users)[![Downloads](https://camo.githubusercontent.com/33bf1c3cfc82452f5cc97a73eefe21fe171214d6d36ec3078d0153f2b6a40026/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176696c742f75736572732f642f746f74616c2e737667)](https://packagist.org/packages/laravilt/users)[![Dependabot Updates](https://github.com/laravilt/users/actions/workflows/dependabot/dependabot-updates/badge.svg)](https://github.com/laravilt/users/actions/workflows/dependabot/dependabot-updates)[![PHP Code Styling](https://github.com/laravilt/users/actions/workflows/fix-php-code-styling.yml/badge.svg)](https://github.com/laravilt/users/actions/workflows/fix-php-code-styling.yml)[![Tests](https://github.com/laravilt/users/actions/workflows/tests.yml/badge.svg)](https://github.com/laravilt/users/actions/workflows/tests.yml)

Complete User and Role management plugin for Laravilt with full RBAC (Role-Based Access Control) system and impersonation support.

Features
--------

[](#features)

### User Management

[](#user-management)

- **Full CRUD Operations** - Create, read, update, and delete users
- **Avatar Support** - Optional user avatars with fallback to UI Avatars
- **Email Verification** - Track email verification status
- **Role Assignment** - Assign multiple roles to users
- **Search &amp; Filters** - Filter users by role, search by name/email

### Role Management

[](#role-management)

- **Complete RBAC** - Full Role-Based Access Control system
- **Permission Groups** - Permissions grouped by resource
- **Bulk Selection** - Select all permissions for a resource
- **Guard Support** - Multiple auth guards support

### Impersonation

[](#impersonation)

- **User Impersonation** - Login as any user for debugging/support
- **Session Preservation** - Original session saved during impersonation
- **Banner Notification** - Visual indicator when impersonating
- **Security Controls** - Cannot impersonate self or super admins

### Localization

[](#localization)

- **Multi-language** - Full English and Arabic translations
- **RTL Support** - Right-to-left layout support for Arabic
- **Translatable Labels** - All fields, actions, and messages translated

Requirements
------------

[](#requirements)

- PHP 8.3+
- Laravel 12+
- Laravilt 1.0+
- Spatie Laravel Permission 6.0+

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

[](#installation)

```
composer require laravilt/users
```

The service provider is auto-discovered and will register automatically.

### Run Migrations

[](#run-migrations)

```
php artisan migrate
```

### Install Plugin

[](#install-plugin)

```
php artisan laravilt:users:install
```

This command will:

- Publish configuration file
- Set up default permissions
- Create default roles (Super Admin, Admin, User)

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

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --tag=laravilt-users-config
```

Configure in `config/laravilt-users.php`:

```
return [
    // Default guard for permissions
    'guard_name' => 'web',

    // Features (opt-in)
    'features' => [
        'impersonation' => false,  // Enable user impersonation
        'avatar' => false,         // Enable user avatars
        'teams' => false,          // Enable team support
        'email_verification' => true,
    ],

    // Navigation settings
    'navigation' => [
        'group' => 'Users & Roles',
        'sort' => 1,
    ],

    // Impersonation settings
    'impersonation' => [
        'redirect_to' => '/admin',
        'leave_redirect_to' => '/admin',
    ],
];
```

Usage
-----

[](#usage)

### Register Plugin with Panel

[](#register-plugin-with-panel)

```
use Laravilt\Users\UsersPlugin;

class AdminPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            ->plugins([
                UsersPlugin::make()
                    ->navigationGroup('Settings')
                    ->navigationSort(10)
                    ->avatar()           // Enable avatars
                    ->impersonation(),   // Enable impersonation
            ]);
    }
}
```

### Plugin Methods

[](#plugin-methods)

```
UsersPlugin::make()
    // Navigation
    ->navigationGroup('Custom Group')  // Set navigation group
    ->navigationSort(5)                // Set navigation order

    // Features (opt-in)
    ->avatar()                         // Enable avatar feature
    ->impersonation()                  // Enable impersonation feature
```

### User Model Setup

[](#user-model-setup)

Add the required traits to your User model:

```
use Laravilt\Users\Concerns\HasRolesAndPermissions;
use Laravilt\Users\Concerns\HasAvatar;

class User extends Authenticatable
{
    use HasRolesAndPermissions;
    use HasAvatar;  // Optional, for avatar support

    // For impersonation support
    public function canImpersonate(): bool
    {
        return $this->hasRole('super_admin');
    }

    public function canBeImpersonated(): bool
    {
        return !$this->hasRole('super_admin');
    }
}
```

### Setting Up Permissions

[](#setting-up-permissions)

Run the setup command to create permissions for all resources:

```
php artisan laravilt:secure
```

This creates permissions like:

- `view_any_user`, `view_user`, `create_user`, `update_user`, `delete_user`
- `view_any_role`, `view_role`, `create_role`, `update_role`, `delete_role`

Impersonation
-------------

[](#impersonation-1)

### Enable Impersonation

[](#enable-impersonation)

```
UsersPlugin::make()->impersonation()
```

### Add Middleware

[](#add-middleware)

Add the impersonation banner middleware to your panel:

```
use Laravilt\Users\Http\Middleware\ImpersonationBanner;

$panel->middleware([
    ImpersonationBanner::class,
]);
```

### Stop Impersonation

[](#stop-impersonation)

Users can stop impersonation via:

- The banner "Stop Impersonation" button
- Route: `GET /admin/impersonation/leave`

Resources
---------

[](#resources)

### UserResource

[](#userresource)

Manages users with:

- Avatar (optional)
- Name and Email
- Password management
- Role assignment
- Email verification status
- Created/Updated timestamps

### RoleResource

[](#roleresource)

Manages roles with:

- Role name
- Guard name
- Permission assignment (grouped by resource)
- User count

Translations
------------

[](#translations)

All strings are translatable. Translation files are located in:

- `lang/en/users.php` - English translations
- `lang/ar/users.php` - Arabic translations

Documentation
-------------

[](#documentation)

Comprehensive documentation is available in the `docs/` directory:

- [Installation](docs/installation.md)
- [Configuration](docs/configuration.md)
- [Users Resource](docs/users.md)
- [Roles Resource](docs/roles.md)
- [Permissions](docs/permissions.md)
- [Impersonation](docs/impersonation.md)

Testing
-------

[](#testing)

```
composer test
```

Code Style
----------

[](#code-style)

```
composer format
```

Static Analysis
---------------

[](#static-analysis)

```
composer analyse
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](.github/CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

Changelog
---------

[](#changelog)

Please see [CHANGELOG.md](CHANGELOG.md) for recent changes.

License
-------

[](#license)

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

Credits
-------

[](#credits)

- [Fady Mondy](https://github.com/fadymondy)
- [Spatie](https://github.com/spatie) for Laravel Permission
- [All Contributors](../../contributors)

Sponsors
--------

[](#sponsors)

Support this project via [GitHub Sponsors](https://github.com/sponsors/fadymondy).

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance88

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 71.4% 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 ~32 days

Total

3

Last Release

130d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2147eb2fca7ab5f0124d0fafd88ba2d2a5dfa3a0036fb8872d1084b7cba29366?d=identicon)[fadymondy](/maintainers/fadymondy)

---

Top Contributors

[![fadymondy](https://avatars.githubusercontent.com/u/11937812?v=4)](https://github.com/fadymondy "fadymondy (15 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")[![swarakaka](https://avatars.githubusercontent.com/u/9349190?v=4)](https://github.com/swarakaka "swarakaka (1 commits)")

---

Tags

pluginlaravelaclrolespermissionsrbacUserslaravilt

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/laravilt-users/health.svg)

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

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k102.4M1.4k](/packages/spatie-laravel-permission)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k3.9M129](/packages/bezhansalleh-filament-shield)[hasinhayder/tyro

Tyro - The ultimate Authentication, Authorization, and Role &amp; Privilege Management solution for Laravel 12 &amp; 13

6783.6k6](/packages/hasinhayder-tyro)[erag/laravel-role-permission

A simple and easy-to-install role and permission management package for Laravel, supporting versions 10.x and 11.x

404.2k](/packages/erag-laravel-role-permission)[phpzen/laravel-rbac

Role based access control for Laravel 5

383.2k](/packages/phpzen-laravel-rbac)

PHPackages © 2026

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