PHPackages                             marufsharia/hyro - 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. marufsharia/hyro

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

marufsharia/hyro
================

Hyro is a modular Laravel RBAC ecosystem featuring advanced role-permission management, admin panel, CRUD generator, plugin system, and API layer — built for scalable SaaS and enterprise applications

v2.0.1(2mo ago)016MITPHPPHP ^8.2

Since Feb 23Pushed 2mo agoCompare

[ Source](https://github.com/marufsharia/hyro)[ Packagist](https://packagist.org/packages/marufsharia/hyro)[ Docs](https://github.com/marufsharia/hyro)[ RSS](/packages/marufsharia-hyro/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (15)Versions (13)Used By (0)

🛡️ Hyro
=======

[](#️-hyro)

### Hyro is a modular Laravel RBAC ecosystem featuring advanced role-permission management, admin panel, CRUD generator, plugin system, and API layer — built for scalable SaaS and enterprise applications

[](#hyro-is-a-modular-laravel-rbac-ecosystem-featuring-advanced-role-permission-management-admin-panel-crud-generator-plugin-system-and-api-layer--built-for-scalable-saas-and-enterprise-applications)

[![Latest Version](https://camo.githubusercontent.com/34e695c6016bc2a934a96bed696e29b2f2ab562a7134d65a55d00653cd506bea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d312e302e302d626c75652e737667)](https://github.com/marufsharia/hyro)[![PHP Version](https://camo.githubusercontent.com/d840cef9807c8f76051ad687841d67f4d830c84e0d83236968e53124ef6742d5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e322d3838393242462e737667)](https://php.net/)[![Laravel Version](https://camo.githubusercontent.com/7aed3dbb1a1293fd5f136ad1d1ae9a68c4ba2cd77a058e81bfb7cc2ecbf76851/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d25334525334431322e302d4646324432302e737667)](https://laravel.com/)[![License](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)](LICENSE)[![Architecture](https://camo.githubusercontent.com/4dd6212bd6707187fc4dd146d0d8397c6e2272e9f518ef06c529b0c0969656ad/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6172636869746563747572652d6d6f64756c61722d627269676874677265656e2e737667)](https://github.com/marufsharia/hyro)

**Modular Architecture • Production-Ready • Zero Configuration • Beautiful UI**

[Features](#-features) • [Installation](#-installation) • [Quick Start](#-quick-start) • [Documentation](DOCUMENTATION.md)

---

📋 Table of Contents
-------------------

[](#-table-of-contents)

- [Overview](#-overview)
- [Modular Architecture](#-modular-architecture)
- [Key Features](#-key-features)
- [Requirements](#-requirements)
- [Installation](#-installation)
- [Quick Start](#-quick-start)
- [CRUD Generator](#-crud-generator)
- [Configuration](#-configuration)
- [Usage Examples](#-usage-examples)
- [CLI Commands](#-cli-commands)
- [API Documentation](#-api-documentation)
- [Security](#-security)
- [Contributing](#-contributing)
- [License](#-license)

---

🎯 Overview
----------

[](#-overview)

**Hyro** is a comprehensive, enterprise-grade Role-Based Access Control (RBAC) and authorization system for Laravel 12+. Built with a modular architecture and modern best practices, Hyro provides everything you need to manage users, roles, privileges, and permissions in your Laravel applications.

### Why Choose Hyro?

[](#why-choose-hyro)

✅ **Modular Architecture** - 6 independent packages working seamlessly together
✅ **Production-Ready** - Battle-tested code ready for enterprise deployment
✅ **Zero Configuration** - Works out of the box with sensible defaults
✅ **Beautiful Admin UI** - Modern, responsive interface built with Livewire 3 &amp; Tailwind CSS
✅ **Powerful CRUD Generator** - Generate complete CRUD interfaces in seconds with 12+ templates
✅ **RESTful API** - Complete API layer with Sanctum authentication
✅ **Plugin System** - Extensible architecture with hot-loadable plugins
✅ **Comprehensive** - Auth, RBAC, audit logs, 2FA, notifications, and more
✅ **Well-Documented** - Extensive documentation and real-world examples

---

🏗️ Modular Architecture
-----------------------

[](#️-modular-architecture)

Hyro v1.0.0 features a **modular architecture** with 6 independent packages that work together seamlessly:

### 📦 Core Package (`marufsharia/hyro-core`)

[](#-core-package-marufshariahyro-core)

**Foundation of the entire system**

- Multi-resolution authorization engine (Token → Privilege → Wildcard → Role → Gate)
- Core models: Role, Privilege, User, AuditLog, UserSuspension, HyroSetting
- Events system for all RBAC operations
- Middleware for route protection
- Contracts and interfaces
- Base services and repositories
- Helper functions and utilities

**Key Features:**

- Hierarchical RBAC with wildcard support (`users.*`, `posts.*.edit`)
- Temporal access control with role expiration
- User suspension management
- Comprehensive audit logging with yearly partitioning
- Cache invalidation system

### 🔐 Auth Package (`marufsharia/hyro-auth`)

[](#-auth-package-marufshariahyro-auth)

**Authentication and security layer**

- Authentication controllers and middleware
- Two-Factor Authentication (2FA) with Google Authenticator
- Token synchronization service for Sanctum
- Emergency access commands
- Password reset and recovery
- Session management

**Key Features:**

- Google Authenticator 2FA with QR codes
- 8 recovery codes per user
- Token-based authentication
- Emergency admin access
- Lockdown mode for security incidents

### 🌐 API Package (`marufsharia/hyro-api`)

[](#-api-package-marufshariahyro-api)

**RESTful API layer**

- Complete REST API with RBAC integration
- API controllers for users, roles, privileges, suspensions
- Request validation and resources
- API middleware and rate limiting
- Sanctum token authentication

**Endpoints:**

- `/api/hyro/auth/*` - Authentication
- `/api/hyro/users/*` - User management
- `/api/hyro/roles/*` - Role management
- `/api/hyro/privileges/*` - Privilege management
- `/api/hyro/suspensions/*` - User suspensions

### 🎨 Admin Panel Package (`marufsharia/hyro-admin-panel`)

[](#-admin-panel-package-marufshariahyro-admin-panel)

**Beautiful admin interface**

- Modern admin UI built with Livewire 3
- Dashboard with statistics and charts
- User, role, and privilege management interfaces
- Settings system with appearance customization
- Plugin manager UI
- Notification center
- Profile management with avatar support
- Sidebar with dynamic menu system

**Key Features:**

- Responsive design with dark mode support
- Real-time updates with Livewire
- Beautiful alerts with Livewire Alert
- Modal dialogs with Wire Elements Modal
- Customizable branding and appearance

### ⚡ CRUD Package (`marufsharia/hyro-crud`)

[](#-crud-package-marufshariahyro-crud)

**Advanced CRUD generator**

- Auto-generate complete CRUD interfaces
- 12+ beautiful templates (2 admin + 10 frontend)
- Auto-generate migrations, models, routes, and views
- Smart route discovery and backup system
- File upload support
- Search, filter, pagination, and sorting
- Export functionality (CSV, Excel, PDF)
- Privilege generation

**Templates:**

- **Admin:** template1 (full-featured), template2 (compact)
- **Frontend:** blog, ecommerce, portfolio, magazine, landing, news, gallery, directory, dashboard, minimal

### 🔌 Plugin Package (`marufsharia/hyro-plugin`)

[](#-plugin-package-marufshariahyro-plugin)

**Extensibility system**

- Plugin system with hot-loading
- Remote plugin installation (GitHub, GitLab, Packagist)
- Hook system for extensibility
- Plugin marketplace integration
- Plugin activity logging
- Plugin settings management
- Plugin permissions and dependencies

**Key Features:**

- Install plugins from remote sources
- Activate/deactivate without code changes
- Hook into system events
- Plugin-specific settings
- Version management

---

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

[](#-key-features)

### 🔐 Advanced Authorization

[](#-advanced-authorization)

- **Multi-Resolution Authorization**: Token → Privilege → Wildcard → Role → Gate
- **Hierarchical RBAC**: Roles with inherited privileges
- **Wildcard Privileges**: `users.*` matches `users.create`, `users.edit`, etc.
- **Temporal Access**: Role expiration and time-based access
- **User Suspension**: Temporary or permanent account suspension
- **Protected Roles**: Prevent deletion of critical roles (super-admin, admin)

### 📊 Enterprise Audit Logging

[](#-enterprise-audit-logging)

- Comprehensive audit trail for all actions
- Yearly table partitioning for performance
- Sensitive data sanitization (passwords, tokens)
- Batch tracking with UUID
- Tag-based filtering and search
- User activity logs

### 🔔 Notification System

[](#-notification-system)

- Multi-channel notifications (Email, Database, Push, SMS)
- Beautiful notification center UI
- Real-time notification bell
- User preference management
- Queue support for performance
- 7 built-in notification types

### ⚡ CRUD Generator

[](#-crud-generator)

- Generate complete CRUD in seconds
- 12+ beautiful templates
- Production-ready code with zero manual fixes
- Auto-generate migrations, models, routes, views
- File upload support
- Search, pagination, sorting
- Export to CSV/Excel/PDF
- Automatic privilege creation

### 👤 User Profile Management

[](#-user-profile-management)

- Complete profile information management
- Avatar management (upload/Gravatar/default)
- Password change with strong validation
- Two-factor authentication setup
- Account deletion with 30-day grace period
- User activity logging
- Timezone and locale settings

### 🎨 Beautiful Admin UI

[](#-beautiful-admin-ui)

- Modern Tailwind CSS interface
- Livewire 3.x components
- Alpine.js interactivity
- Fully responsive design
- Dark mode support
- Customizable branding
- Icon customization (115+ Heroicons)

### 💻 50+ CLI Commands

[](#-50-cli-commands)

- User management commands
- Role and privilege management
- Plugin management
- Database backup and restore
- Emergency access commands
- CRUD generation commands

---

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

[](#-requirements)

- **PHP:** 8.2 or higher
- **Laravel:** 12.0 or higher
- **Database:** MySQL 8.0+, PostgreSQL 13+, or SQLite 3.35+
- **Composer:** 2.0 or higher
- **Node.js:** 18+ (for asset compilation)
- **NPM/Yarn:** Latest version

### Required PHP Extensions

[](#required-php-extensions)

- OpenSSL, PDO, Mbstring, Tokenizer, XML, Ctype, JSON, BCMath, Fileinfo

---

🚀 Installation
--------------

[](#-installation)

### Step 1: Install via Composer

[](#step-1-install-via-composer)

```
composer require marufsharia/hyro
```

### Step 2: Publish Configuration and Assets

[](#step-2-publish-configuration-and-assets)

```
# Publish configuration
php artisan vendor:publish --tag=hyro-config

# Publish migrations
php artisan vendor:publish --tag=hyro-migrations

# Publish assets (CSS, JS, images)
php artisan vendor:publish --tag=hyro-assets
```

### Step 3: Configure Environment

[](#step-3-configure-environment)

Add to your `.env` file:

```
# Core Settings
HYRO_ENABLED=true
HYRO_ADMIN_PREFIX=admin/hyro

# Features
HYRO_API_ENABLED=true
HYRO_ADMIN_ENABLED=true
HYRO_CLI_ENABLED=true

# Security
HYRO_FAIL_CLOSED=true
HYRO_PROTECTED_ROLES=super-admin,admin
HYRO_PASSWORD_MIN_LENGTH=8

# Cache
HYRO_CACHE_ENABLED=true
HYRO_CACHE_TTL=3600

# Audit Logging
HYRO_AUDIT_ENABLED=true
HYRO_AUDIT_RETENTION_DAYS=365
```

### Step 4: Run Migrations

[](#step-4-run-migrations)

```
php artisan migrate
```

### Step 5: Create Admin User

[](#step-5-create-admin-user)

```
php artisan hyro:user:create --admin
```

Follow the prompts to create your first admin user.

### Step 6: Add Trait to User Model

[](#step-6-add-trait-to-user-model)

Edit `app/Models/User.php`:

```
