- How do I install this package in a Laravel 11 project?
- Run `composer require codeflextech/permission-manager`, publish the config and assets with `php artisan vendor:publish --tag=permission-manager-config` and `--tag=permission-manager-assets`, then ensure `spatie/laravel-permission` migrations are run (`php artisan migrate`). Add the `HasRoles` trait to your `User` model and visit `/permission-manager` to access the UI.
- Does this work with Laravel Sanctum or Passport for API auth?
- Yes, but you must configure the `guard` option in `config/permission-manager.php` to match your auth guard (e.g., `guard => 'api'`). The package supports custom guards and middleware, so it integrates with Sanctum, Passport, or other auth systems.
- Can I use this without Livewire 3 in my project?
- No, this package requires Livewire 3 for its reactive UI. If your project avoids Livewire, consider alternatives like `spatie/laravel-permission` with a custom Blade-based UI or packages like `orchid/permissions`.
- How do I customize the UI or override styles?
- Publish the views with `php artisan vendor:publish --tag=permission-manager-views` to override Blade templates. For CSS, use `php artisan vendor:publish --tag=permission-manager-assets` and modify the published stylesheet. The package ships standalone CSS, so no Tailwind dependency is needed.
- What Laravel versions and PHP versions are supported?
- This package requires **Laravel 11** and **PHP 8.2+**. It depends on `spatie/laravel-permission ^6.0` and `livewire/livewire ^3.0`, so ensure compatibility with your stack.
- How do I protect the permission manager UI from unauthorized access?
- The package includes a `super_admin_role` config option (default: `super_admin`) that blocks deletion of the super admin role. Add middleware to the `middleware` array in `config/permission-manager.php` to restrict access (e.g., `['web', 'auth', 'verified']`).
- Does this package handle database migrations automatically?
- No, it assumes `spatie/laravel-permission` tables already exist. Run `php artisan migrate` after installing `spatie/laravel-permission` (^6.0) to create the required tables (`permissions`, `roles`, etc.).
- Can I use this with a microservices architecture or shared permissions?
- This package is designed for single Laravel instances. If permissions are shared across microservices, consider a centralized permission service or a custom solution like `spatie/laravel-permission` with API endpoints.
- Are there any performance concerns with large permission sets?
- Livewire 3 handles permission CRUD efficiently, but large sets (>1000 permissions) may impact UI responsiveness. Test in staging and monitor Livewire hydration. The permission matrix uses grouped checkboxes to mitigate performance issues.
- What alternatives exist if this package doesn’t fit my needs?
- For Livewire-based RBAC, try `orchid/permissions` or `filament/filament`. For Blade-only solutions, use `spatie/laravel-permission` with custom controllers. For advanced ACLs, consider ` Entrust` or `spatie/laravel-permission` with policy-based checks.