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

ActiveLibrary

backstage/laravel-users
=======================

This is my package laravel-users

v2.0.29(1w ago)085↓100%[1 PRs](https://github.com/backstagephp/laravel-users/pulls)1MITPHPPHP ^8.2CI passing

Since May 10Pushed yesterday2 watchersCompare

[ Source](https://github.com/backstagephp/laravel-users)[ Packagist](https://packagist.org/packages/backstage/laravel-users)[ Docs](https://github.com/backstage/laravel-users)[ GitHub Sponsors](https://github.com/vormkracht10)[ RSS](/packages/backstage-laravel-users/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (15)Versions (247)Used By (1)

Laravel Users
=============

[](#laravel-users)

A modern user management package for Laravel, built by [Backstage](https://backstagephp.com).

---

✨ Introduction
--------------

[](#-introduction)

`backstage/laravel-users` is a full-featured Laravel package that provides a complete user management foundation for Laravel 10 &amp; 11 applications. It leverages Laravel Sanctum and Spatie Permissions to deliver robust authentication, authorization, and user preference handling.

This package includes support for user login tracking, traffic monitoring, preferences, factory seeding, and customizable scaffolding—all designed to scale with your application.

---

📦 Features
----------

[](#-features)

- ✅ Custom user model with Laravel Auth integration
- 🔐 Role and permission support via [Spatie Laravel Permission](https://spatie.be/docs/laravel-permission)
- 🔑 API token authentication via Laravel Sanctum
- 🔧 Configurable user system with feature toggles
- 🧪 Built-in factory and seeder
- 📊 Tracks login events and traffic history
- 🧩 Modular architecture with domain-driven design (DDD) patterns
- 🛠 Artisan commands for user management (`make`, `list`, `delete`)
- 📨 Email-based username generation
- 🔄 Password generation utility
- 🧠 Customizable notification &amp; sub-navigation preferences

---

🧰 Requirements
--------------

[](#-requirements)

- PHP ^8.2
- Laravel ^10.0 or ^11.0
- Composer

---

⚙️ Installation
---------------

[](#️-installation)

Install via Composer:

```
composer require backstage/laravel-users
```

Publish configuration, migration, and seeder files:

```
php artisan vendor:publish --tag="laravel-users-config"
php artisan vendor:publish --tag="laravel-users-migrations"
```

Run database migrations:

```
php artisan migrate
```

---

🛠 Configuration
---------------

[](#-configuration)

### 1. Set the User Provider

[](#1-set-the-user-provider)

Update `config/auth.php` to use the package's custom user model:

```
'providers' => [
    'users' => [
        'driver' => 'eloquent',
        'model' => \Backstage\Laravel\Users\Models\User::class,
    ],
],
```

### 2. Enable Sanctum API Tokens

[](#2-enable-sanctum-api-tokens)

If you haven't already:

```
composer require laravel/sanctum
php artisan vendor:publish --provider="Laravel\\Sanctum\\SanctumServiceProvider"
php artisan migrate
```

### 3. Setup Spatie Permissions

[](#3-setup-spatie-permissions)

Ensure Spatie permissions are published:

```
composer require spatie/laravel-permission
php artisan vendor:publish --provider="Spatie\\Permission\\PermissionServiceProvider"
php artisan migrate
```

Edit `config/permission.php` to adjust your roles and permission settings.

---

🧩 Customization
---------------

[](#-customization)

You can modify `config/users.php` to change:

- Default roles
- Middleware behavior
- Feature toggles (registration, email verification, etc.)
- UI scaffolding paths (if applicable)

---

🧑‍💻 Artisan Commands
--------------------

[](#‍-artisan-commands)

The package includes a suite of CLI tools:

CommandDescription`artisan make:user`Create a new user interactively`artisan users:list`List users in a table format`artisan users:delete`Delete a user by ID or emailExample:

```
artisan make:user --email=user@example.com --name="John Doe" --role=admin
```

---

🧱 Architecture
--------------

[](#-architecture)

### Key Classes

[](#key-classes)

- **UserManager**: Central config-driven service for runtime overrides
- **Domain/Email/Actions**:
    - `GenerateUsernameFromEmail`
    - `ExtractDomainFromEmail`
    - `ValidateEmail`
- **Domain/Password/Actions**:
    - `GeneratePassword`
- **Eloquent/Concerns/User**:
    - Modular traits like `HasAttributes`, `HasScopes`, `HasRelations`
- **Models**:
    - `User`, `UserLogin`, `UserTraffic`, `UserNotificationPreferences`

### Migrations Included

[](#migrations-included)

- Adds sub-navigation and notification preferences to users
- Tracks user logins and traffic history
- Supports nullable password for third-party auth

---

🧪 Testing
---------

[](#-testing)

Run PHPUnit tests via:

```
vendor/bin/phpunit
```

Ensure your `.env.testing` or `phpunit.xml` is configured with a test database.

---

🔬 Development
-------------

[](#-development)

### Local Package Development

[](#local-package-development)

If you're contributing or using this in a monorepo:

1. Clone the package into `packages/` or your preferred folder
2. Add this to your Laravel app's `composer.json`:

```
"repositories": [
  {
    "type": "path",
    "url": "packages/laravel-users"
  }
],
```

3. Require the package:

```
composer require backstage/laravel-users:*
```

4. Refresh autoload:

```
composer dump-autoload
```

---

🤝 Contributing
--------------

[](#-contributing)

Contributions are welcome! Please follow the PSR-12 coding standard and submit pull requests with clear descriptions.

---

📄 License
---------

[](#-license)

This package is open-sourced software licensed under the [MIT license](LICENSE.md).

---

👤 Author
--------

[](#-author)

**Manoj Hortulanus**
Developer at [Backstage](https://backstagephp.com)
📧

---

🏁 Credits
---------

[](#-credits)

- [Backstage](https://backstagephp.com) for sponsoring development
- [Spatie](https://spatie.be) for the excellent permission package
- [Laravel](https://laravel.com) for the amazing framework

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance99

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~1 days

Total

205

Last Release

10d ago

Major Versions

v1.1.51 → v2.0.0-beta142026-01-07

v1.1.52 → v2.0.0-beta152026-01-12

v1.1.53 → v2.0.0-beta162026-01-13

v1.1.54 → v2.0.0-beta232026-01-21

v1.0 → v2.0.0-beta1202026-02-19

### Community

Maintainers

![](https://www.gravatar.com/avatar/7c6a425dc8645907a118a007438172d58c2016773f54ab3a834beff172632f13?d=identicon)[ux](/maintainers/ux)

---

Top Contributors

[![mhortulanus](https://avatars.githubusercontent.com/u/91618246?v=4)](https://github.com/mhortulanus "mhortulanus (3 commits)")[![Baspa](https://avatars.githubusercontent.com/u/10845460?v=4)](https://github.com/Baspa "Baspa (1 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laravelbackstagelaravel-users

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[binary-cats/laravel-rbac

Laravel 11 enum-backed RBAC extension of spatie/laravel-permission

7725.9k](/packages/binary-cats-laravel-rbac)[vormkracht10/laravel-open-graph-image

Laravel package to generate dynamic Open Graph images

7117.5k](/packages/vormkracht10-laravel-open-graph-image)[backstage/laravel-og-image

Laravel package to generate dynamic Open Graph images

702.4k](/packages/backstage-laravel-og-image)[vormkracht10/laravel-google-analytics-v4

Laravel package to get insights in Google Analytics v4 data

367.0k](/packages/vormkracht10-laravel-google-analytics-v4)

PHPackages © 2026

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