appsco/assertion-voter-bundle
symfony/dependency-injection, symfony/http-kernel). Laravel’s Service Container and Event System can host similar logic.RoleResolver to a custom class).DecisionMakerInterface as a Laravel service provider or trait.symfony/dependency-injection (v2.1). Laravel’s container is compatible but may need adapters (e.g., symfony/dependency-injection wrapper).| Risk Area | Mitigation Strategy |
|---|---|
| Symfony 2.x Deprecation | Abstract Symfony-specific code; use PSR-11/PSR-15 interfaces for Laravel compatibility. |
| Lack of Maintenance | Fork/rebase for Laravel; replace deprecated Symfony components (e.g., EventDispatcher). |
| Performance Overhead | Benchmark role resolution with large datasets; optimize VoterRecord queries. |
| Testing Gaps | Write Pest/Laravel tests for custom providers/decision makers. |
| Security | Validate assertion inputs (e.g., SQL injection in DBAL provider). |
department=finance") or coarse-grained (e.g., OAuth2 scopes)?VoterRecord use Eloquent, raw SQL, or an external API (e.g., Redis for caching)?laravel-assertion-voter) or refactored natively?AppServiceProvider::boot()).EventDispatcher.VoterRecord as an Eloquent model).config.yml to Laravel’s config/assertion-voter.php.Gate::define())Authorizable)Phase 1: Proof of Concept
VoterRecord Eloquent model and RoleResolver service.ROLE_ADMIN if user.is_admin = true).Phase 2: Core Integration
EventDispatcher with Laravel’s Events.DecisionMakerInterface to Laravel’s service container.config/assertion-voter.php).Phase 3: Extensions
VoterRecord model).VoterRecord queries.| Component | Laravel Equivalent | Notes |
|---|---|---|
DependencyInjection |
Laravel Service Container | Use bind() or extend() for Symfony-specific services. |
EventDispatcher |
Laravel Events (event(new ...)) |
Replace listeners with Laravel’s listen() method. |
| Doctrine ORM | Eloquent | Map BaseVoterRecord to an Eloquent model. |
| Doctrine DBAL | Query Builder or Eloquent | Use raw queries if needed. |
config.yml |
config/assertion-voter.php |
Publish config via publishes in ServiceProvider. |
Kernel |
AppServiceProvider |
Register bundle services in register(). |
VoterRecord as Eloquent.RoleResolver to Laravel’s container.vendor/appsco/legacy-assertion-voter).symfony/dependency-injection) for breaking changes.Log::debug()) for assertion resolution.VoterRecord queries are cached (e.g., Cache::remember()).with() or accessors for VoterRecord.Cache::forever()).VoterRecord caching.VoterRecord lookHow can I help you explore Laravel packages today?