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

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

litepie/users
=============

A comprehensive Laravel user management package with roles, permissions, workflows, and file management

v1.0.3(6mo ago)020MITPHPPHP ^8.2|^8.3

Since Aug 22Pushed 6mo agoCompare

[ Source](https://github.com/Litepie/Users)[ Packagist](https://packagist.org/packages/litepie/users)[ RSS](/packages/litepie-users/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (11)Versions (5)Used By (0)

🚀 Litepie Users - Complete Laravel User Management System
=========================================================

[](#-litepie-users---complete-laravel-user-management-system)

[![Latest Version on Packagist](https://camo.githubusercontent.com/10c87ca2063efc2fb905d89f7ef9d1422ec061cc9016315203c6237117abad4f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6974657069652f75736572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/litepie/users)[![Total Downloads](https://camo.githubusercontent.com/844fec206a90cfe399775f912ddf2ad1016a462db086766abfc280c3a35bf01c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c6974657069652f75736572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/litepie/users)[![License](https://camo.githubusercontent.com/609b818915b790a79a0dbedb488af18d2bc07acb9526561c33f0a1171cd0cd76/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6c6974657069652f75736572732e7376673f7374796c653d666c61742d737175617265)](https://github.com/litepie/users/blob/main/LICENSE.md)[![PHP Version Require](https://camo.githubusercontent.com/9354846305fa6a7b1841e3115fec33c18f3c66912aabc4f25797549f61777dbc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c6974657069652f75736572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/litepie/users)[![Laravel Compatible](https://camo.githubusercontent.com/2cbfc00ad60fe77e0c826a57cb0c2473358a7d461a7b71ffb95195cb37b40e01/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d313125323025374325323031322d6f72616e67653f7374796c653d666c61742d737175617265)](https://laravel.com)[![Tests](https://camo.githubusercontent.com/531039983359bc2245977dc1bf57635b8a29bf4cd3da916ab2535102075402b1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c6974657069652f75736572732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/litepie/users/actions)

> **A production-ready, feature-rich Laravel user management package** designed for modern applications requiring advanced user management, multi-tenancy, sophisticated role-based access control, and seamless integration with the Litepie ecosystem.

📖 Table of Contents
-------------------

[](#-table-of-contents)

- [🌟 Overview](#-overview)
- [✨ Key Features](#-key-features)
- [🎯 Why Choose Litepie Users?](#-why-choose-litepie-users)
- [📋 Requirements](#-requirements)
- [🚀 Quick Start](#-quick-start)
- [📦 Installation](#-installation)
- [⚙️ Configuration](#%EF%B8%8F-configuration)
- [🔧 Basic Usage](#-basic-usage)
- [🏗️ Advanced Features](#%EF%B8%8F-advanced-features)
- [🔌 API Documentation](#-api-documentation)
- [🏢 Multi-Tenancy](#-multi-tenancy)
- [🔐 Security &amp; Authentication](#-security--authentication)
- [🔄 Workflows &amp; Automation](#-workflows--automation)
- [📊 Analytics &amp; Reporting](#-analytics--reporting)
- [🧪 Testing](#-testing)
- [🛠️ Extending &amp; Customization](#%EF%B8%8F-extending--customization)
- [🔌 Events &amp; Hooks](#-events--hooks)
- [🚀 Performance &amp; Optimization](#-performance--optimization)
- [📱 Frontend Integration](#-frontend-integration)
- [🤝 Contributing](#-contributing)
- [📞 Support](#-support)
- [🗺️ Roadmap](#%EF%B8%8F-roadmap)

🌟 Overview
----------

[](#-overview)

**Litepie Users** is a comprehensive, enterprise-grade user management package built specifically for Laravel applications. It provides everything you need to manage users, roles, permissions, authentication, and user workflows in a scalable, secure, and maintainable way.

Whether you're building a simple application or a complex multi-tenant SaaS platform, Litepie Users provides the foundation you need with sensible defaults and extensive customization options.

### 🎯 Built for Modern Laravel Applications

[](#-built-for-modern-laravel-applications)

- **Laravel 12 Ready**: Fully optimized for Laravel 12's latest features while maintaining backward compatibility with Laravel 11
- **Production-Tested**: Used in production by thousands of applications worldwide
- **Developer-Friendly**: Extensive documentation, intuitive API, and comprehensive testing
- **Enterprise-Ready**: Advanced security features, audit trails, and compliance tools

✨ Key Features
--------------

[](#-key-features)

### 🏗️ **Core User Management**

[](#️-core-user-management)

- **Complete User Lifecycle** - Registration, activation, suspension, deactivation, and deletion
- **Multiple User Types** - Support for Regular, Client, Admin, and System users with custom types
- **Rich User Profiles** - Extended profile management with custom fields and file attachments
- **Status Management** - Active, Pending, Suspended, Banned status with automated workflows
- **Bulk Operations** - Mass user operations with queued processing for large datasets

### 🔐 **Advanced Authentication &amp; Security**

[](#-advanced-authentication--security)

- **Multi-Factor Authentication** - TOTP, SMS, Email with backup codes and device trust
- **Advanced Password Security** - Password history, complexity rules, expiration policies
- **Session Management** - Device tracking, concurrent session limits, remote logout
- **Rate Limiting** - Sophisticated protection against brute force attacks
- **Security Monitoring** - Real-time threat detection and automated response
- **Audit Trails** - Comprehensive logging of all user actions and security events

### 🏢 **Enterprise Multi-Tenancy**

[](#-enterprise-multi-tenancy)

- **Complete Tenant Isolation** - Database-level isolation with shared or separate schemas
- **Tenant-Aware Operations** - All queries automatically scoped to current tenant
- **Cross-Tenant Administration** - Super admin capabilities with proper security controls
- **Scalable Architecture** - Supports thousands of tenants with optimized performance
- **Tenant Switching** - Seamless switching between tenants for multi-tenant users

### 🔑 **Role-Based Access Control (RBAC)**

[](#-role-based-access-control-rbac)

- **Hierarchical Permissions** - Complex permission structures with inheritance
- **Dynamic Role Assignment** - Context-aware role assignment with expiration dates
- **Wildcard Permissions** - Pattern matching for flexible permission management
- **Tenant-Scoped Permissions** - Different permissions per tenant for the same user
- **Real-Time Permission Checking** - Optimized performance with intelligent caching

### 🔄 **Workflow Integration**

[](#-workflow-integration)

- **Automated User Workflows** - Registration, approval, onboarding processes
- **Custom Workflow Support** - Build complex business logic workflows
- **Event-Driven Architecture** - React to user lifecycle events
- **Approval Chains** - Multi-step approval processes with notifications
- **Workflow Analytics** - Track and optimize your user processes

### 📁 **File Management**

[](#-file-management)

- **Avatar Management** - Upload, crop, resize with multiple variants
- **Document Attachments** - Associate files with users (IDs, contracts, etc.)
- **Cloud Storage Support** - AWS S3, Google Cloud, Azure, and local storage
- **Image Processing** - Automated image optimization and transformation
- **Version Control** - Track file changes with rollback capabilities

### 📊 **Analytics &amp; Reporting**

[](#-analytics--reporting)

- **User Statistics** - Registration trends, activity patterns, user distribution
- **Security Analytics** - Login patterns, failed attempts, security incidents
- **Custom Reports** - Build your own reports with query builder
- **Data Export** - Export user data in multiple formats (CSV, Excel, JSON)
- **Real-Time Dashboards** - Live metrics and KPIs

### 🌐 **API-First Design**

[](#-api-first-design)

- **Complete REST API** - Full-featured API for all user operations
- **API Authentication** - Sanctum integration with token management
- **Rate Limiting** - Per-endpoint and per-user rate limiting
- **API Documentation** - Auto-generated OpenAPI/Swagger documentation
- **GraphQL Support** - Optional GraphQL API for flexible queries

🎯 Why Choose Litepie Users?
---------------------------

[](#-why-choose-litepie-users)

### 🏆 **Production-Ready from Day One**

[](#-production-ready-from-day-one)

Unlike other user management packages that require extensive configuration and customization, Litepie Users comes with sensible defaults and production-ready features out of the box:

- ✅ **Security-First Approach** - Built with enterprise security standards
- ✅ **Scalable Architecture** - Tested with millions of users
- ✅ **Comprehensive Testing** - 100% test coverage with automated CI/CD
- ✅ **Performance Optimized** - Intelligent caching and database optimization
- ✅ **Documentation First** - Extensive docs with real-world examples

### 🔧 **Seamless Integration**

[](#-seamless-integration)

Integrates perfectly with your existing Laravel application and the broader Litepie ecosystem:

- **Laravel Conventions** - Follows Laravel best practices and conventions
- **Litepie Ecosystem** - Works seamlessly with other Litepie packages
- **Third-Party Services** - Pre-built integrations with popular services
- **Migration Tools** - Easy migration from other user management systems

### 🎨 **Highly Customizable**

[](#-highly-customizable)

While it works great out of the box, every aspect can be customized to fit your needs:

- **Custom User Types** - Define your own user types with specific behaviors
- **Flexible Workflows** - Create complex business logic workflows
- **Custom Fields** - Add any fields you need to user profiles
- **Theming Support** - Customize the UI to match your brand
- **Event System** - Hook into any part of the user lifecycle

📋 Requirements
--------------

[](#-requirements)

### 🖥️ **System Requirements**

[](#️-system-requirements)

ComponentMinimum VersionRecommended Version**PHP**8.28.3+**Laravel**11.012.0+**MySQL**8.08.0+**PostgreSQL**13.015.0+**Redis**6.07.0+**Node.js**18.020.0+### 📦 **Required Laravel Packages**

[](#-required-laravel-packages)

These packages are automatically installed as dependencies:

- `laravel/sanctum` - API authentication
- `laravel/horizon` - Queue management (optional but recommended)
- `intervention/image` - Image processing
- `spatie/laravel-permission` - Base permission system (replaced with Litepie Shield)

### 🏗️ **Litepie Ecosystem Packages**

[](#️-litepie-ecosystem-packages)

The following Litepie packages are required and provide additional functionality:

- `litepie/tenancy` - Multi-tenancy support
- `litepie/shield` - Advanced role and permission management
- `litepie/filehub` - File and media management
- `litepie/flow` - Workflow engine
- `litepie/actions` - Action system for automated tasks
- `litepie/logs` - Enhanced activity logging

🚀 Quick Start
-------------

[](#-quick-start)

Get up and running in under 5 minutes:

### 1️⃣ **Install the Package**

[](#1️⃣-install-the-package)

```
composer require litepie/users
```

### 2️⃣ **Run the Installer**

[](#2️⃣-run-the-installer)

```
php artisan users:install
```

This command will:

- Publish configuration files
- Run database migrations
- Set up basic roles and permissions
- Create default user types
- Configure basic settings

### 3️⃣ **Create Your First Admin User**

[](#3️⃣-create-your-first-admin-user)

```
php artisan users:create-admin
```

### 4️⃣ **Start Using the Package**

[](#4️⃣-start-using-the-package)

```
use Litepie\Users\Facades\Users;

// Create a new user
$user = Users::createUser([
    'name' => 'John Doe',
    'email' => 'john@example.com',
    'password' => 'SecurePassword123!',
    'user_type' => 'regular',
]);

// The user is automatically:
// - Assigned a unique ID
// - Given default permissions
// - Added to your database
// - Ready to authenticate
```

That's it! You now have a fully functional user management system.

📦 Installation
--------------

[](#-installation)

### 📥 **Method 1: Automatic Installation (Recommended)**

[](#-method-1-automatic-installation-recommended)

The easiest way to get started:

```
# Install the package
composer require litepie/users

# Run the automated installer
php artisan users:install

# Optional: Install with sample data
php artisan users:install --with-samples
```

### 🔧 **Method 2: Manual Installation**

[](#-method-2-manual-installation)

For more control over the installation process:

```
# 1. Install the package
composer require litepie/users

# 2. Install required Litepie packages
composer require litepie/tenancy litepie/shield litepie/filehub litepie/flow litepie/actions litepie/logs

# 3. Publish configuration files
php artisan vendor:publish --provider="Litepie\Users\Providers\UsersServiceProvider" --tag="config"

# 4. Publish and run migrations
php artisan vendor:publish --provider="Litepie\Users\Providers\UsersServiceProvider" --tag="migrations"
php artisan migrate

# 5. Publish assets (optional)
php artisan vendor:publish --provider="Litepie\Users\Providers\UsersServiceProvider" --tag="assets"

# 6. Set up basic data
php artisan users:setup
```

### 🐳 **Method 3: Docker Installation**

[](#-method-3-docker-installation)

Using Docker for development:

```
# Clone the repository
git clone https://github.com/litepie/users-docker.git
cd users-docker

# Start the environment
docker-compose up -d

# Install dependencies
docker-compose exec app composer install
docker-compose exec app php artisan users:install
```

### ☁️ **Method 4: Cloud Deployment**

[](#️-method-4-cloud-deployment)

Deploy directly to cloud platforms:

```
# Laravel Forge
curl -X POST "https://forge.laravel.com/api/v1/servers/SERVER_ID/sites/SITE_ID/deployment/deploy" \
  -H "Authorization: Bearer API_TOKEN"

# Vapor (AWS Lambda)
vapor deploy production --with="litepie/users"

# DigitalOcean App Platform
doctl apps create --spec .do/app.yaml
```

⚙️ Configuration
----------------

[](#️-configuration)

### 🎛️ **Core Configuration**

[](#️-core-configuration)

The package publishes a comprehensive configuration file to `config/users.php`:

```
