Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Horus Laravel Package

hans-thomas/horus

Horus streamlines roles and permissions in Laravel with Spatie Laravel Permission integration. Batch-create roles/permissions, generate model permissions from policies, and assign permissions to roles quickly. Works with Laravel 10–12 and is supported by Sphinx.

View on GitHub
Deep Wiki
Context7

Roles and permissions registerer based on spatie/laravel-permission

Frequently asked questions about Horus
How does Horus differ from spatie/laravel-permission for Laravel role/permission management?
Horus builds on spatie/laravel-permission but adds batch operations for roles/permissions and auto-generates permissions from Laravel policies (e.g., `PostPolicy::update`). It’s ideal for teams needing bulk setup or policy-driven permissions without manual configuration.
Can I use Horus without installing spatie/laravel-permission first?
No, Horus requires spatie/laravel-permission as a dependency. Install it first via `composer require spatie/laravel-permission`, publish its config, and run migrations before adding Horus.
Does Horus support Laravel 13? Will it break in future updates?
Horus officially supports Laravel 10–12. Laravel 13+ is untested, so minor breaking changes could occur if adopted. Monitor the GitHub repo for updates or check compatibility before upgrading.
How do I generate permissions from a model’s policy class?
Enable Sphinx support in `config/horus.php` and set the `policy_namespace` (e.g., `App\Policies`). Run `php artisan horus:generate-permissions` to auto-create permissions based on your policy methods like `update`, `delete`, etc.
What’s the performance impact of batch role/permission creation?
Horus uses Spatie’s underlying database operations, which are optimized for bulk inserts. For large-scale systems (e.g., 10K+ roles), test with your dataset—caching (e.g., Laravel’s permission cache) can mitigate overhead.
Can I assign permissions to roles dynamically at runtime?
Yes, Horus extends Spatie’s role-permission assignments. Use `Role::find(1)->givePermissionTo('edit-post')` or batch methods like `Role::find(1)->syncPermissions(['edit-post', 'delete-post'])` for dynamic updates.
Are there alternatives to Horus for Laravel RBAC with policy integration?
For policy-based permissions, consider `spatie/laravel-permission` alone (manual setup) or `entrust` (older, less maintained). Horus is unique in combining Spatie’s stability with batch operations and Sphinx’s policy integration.
How do I migrate existing roles/permissions from another package to Horus?
Export your current roles/permissions (e.g., via Spatie’s `Role::all()` or raw SQL), then use Horus’s batch methods to recreate them. Example: `Role::create(['name' => 'admin']); Role::find(1)->givePermissionTo('manage-users');`
Does Horus work with multi-tenancy (e.g., SaaS platforms)?
Yes, Horus supports multi-tenancy if you use Spatie’s `hasMany` role-permission relationships per tenant. Combine it with packages like `stancl/tenancy` for tenant-aware role assignments.
How do I test Horus in a CI pipeline? What edge cases should I cover?
Test role/permission creation, policy permission generation, and batch assignments. Edge cases include concurrent role updates, permission cache invalidation, and edge cases like empty policy classes or duplicate permissions.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor