Download the PHP package grazulex/laravel-multipersona without Composer
On this page you can find all versions of the php package grazulex/laravel-multipersona. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download grazulex/laravel-multipersona
More information about grazulex/laravel-multipersona
Files in grazulex/laravel-multipersona
Package laravel-multipersona
Short Description Laravel MultiPersona is a lightweight context-layer system for Laravel users. It allows a single user to switch between different roles, accounts, or tenants dynamically, without creating multiple logins or sessions.
License MIT
Homepage https://github.com/grazulex/laravel-multipersona
Informations about the package laravel-multipersona
Laravel MultiPersona
Laravel MultiPersona is a lightweight context-layer system for Laravel users.
Laravel MultiPersona is a lightweight context-layer system for Laravel users.
It allows a single user to switch between different roles, accounts, or tenants dynamically, without creating multiple logins or sessions.
๐ What It Solves
- Switch between "personas" (admin โ client, company A โ company B)
- Contextual permissions and role handling
- No UI or API enforced โ 100% backend, policy, and middleware-driven
๐ฆ Installation
๐งฉ Core Concepts
- Persona: A context attached to a user (e.g. company, role, project)
- Active Persona: The currently selected context
- Persona Manager: A service to query, switch, or manipulate personas
- Middleware: Force or apply a persona context
โ Quick Example
๐งฑ What's Provided
- Trait:
HasPersonasfor yourUsermodel - Middleware:
EnsureActivePersona,SetPersonaFromRequest - Helpers:
persona(),personas($user) - Events: Complete event system for persona lifecycle
- Service:
PersonaManagerfor programmatic access - Contract:
PersonaInterfacefor custom implementations
โ What's Not Included
- No routes or controllers
- No CLI or HTTP APIs
- No UI layer โ you choose how to expose it
๐ Complete Documentation
Getting Started
- ๐ Installation Guide - Complete setup instructions
- ๏ฟฝ Usage Guide - Basic and advanced usage examples
- โก Quick Start Example - Working code examples
Core Features
- ๐ญ Events Guide - Event system and listeners
- ๐ก๏ธ Middleware Guide - Route protection and context
- ๐๏ธ Architecture - System design and components
Advanced Topics
- ๐ฏ Advanced Patterns - Multi-tenant, role hierarchy, delegation
- ๐ Frontend Integration - Vue.js, React, Alpine.js examples
- ๐ API Reference - Complete method documentation
Use Cases
- Multi-tenant SaaS: Users switch between different company contexts
- Role-based Access: Same user, different permissions per context
- Agency Management: Manage multiple client accounts
- Marketplace Platforms: Buyer/seller context switching
- Enterprise Systems: Department or project-based access
๐ฏ Real-World Examples
Multi-tenant Application
Middleware Protection
Frontend Integration
๐งช Testing
The package includes comprehensive test coverage:
Current test metrics:
- 58 tests across Unit, Feature, Integration, and Listeners
- 87% code coverage
- 149 assertions ensuring reliability
๐ค Contributing
We welcome contributions! See our Contributing Guide for details.
Development Setup
๐ Security
If you discover any security vulnerabilities, please review our Security Policy.
๐ License
Laravel MultiPersona is open-sourced software licensed under the MIT license.
Made with โค๏ธ for the Laravel community
๐ Documentation โข ๐ Report Issues โข ๐ฌ Discussions