- Can I install kphoen/rulerz-bundle in a Laravel application?
- No. It is a Symfony bundle that requires symfony/framework-bundle ^2.8|^3.0, registers itself through Kernel::registerBundles() and ships a DependencyInjection extension, none of which exist in Laravel. Composer dependency resolution will fail immediately on a Laravel 10 or 11 project. The only credible route is requiring the underlying kphoen/rulerz core library and wiring it yourself.
- Which Laravel and PHP versions does kphoen/rulerz-bundle support?
- It targets Symfony 2.8 and 3.x on PHP 5.6 and above, and its last release was June 2016. There is no declared Laravel support at all, and it is not tested against PHP 8.2 or 8.3. Treat it as incompatible with any current Laravel version rather than trying to force it with --ignore-platform-reqs.
- How do I install and register kphoen/rulerz-bundle in a Symfony app?
- Run composer require kphoen/rulerz-bundle, then add the bundle class to the registerBundles() array in your AppKernel. Configuration lives under the bundle's config key in config.yml, where you declare targets, compilers and operators. This workflow only applies to legacy Symfony 2.8 and 3.x applications.
- What is the Laravel equivalent of RulerZBundle?
- There is no bundle equivalent because Laravel uses service providers rather than bundles and compiler passes. The practical replacement is a small service provider that binds the RulerZ engine as a singleton and registers whichever compilers you need. For simple boolean expressions, symfony/expression-language is a lighter, actively maintained substitute. For authorization, Laravel Policies and Gates usually cover the same ground with zero extra dependencies.
- How do I use RulerZ in Laravel without the bundle?
- Require kphoen/rulerz only, then create a service provider that binds the RulerZ engine, instantiates the native or array compiler (and the Doctrine compiler only if you genuinely use Doctrine) and registers the rule parser. Replace the bundle's Twig extension with a Blade directive or a Gate-adjacent helper so authorization stays in one place. Prefer Specification classes over raw DSL strings in config so rules remain unit-testable and IDE-navigable. The bundle's YAML files are still useful as reference documentation for which services to bind.
- Does RulerZ work with Eloquent or only with Doctrine?
- RulerZ ships compilers for in-memory arrays and objects plus a Doctrine DQL compiler, and the bundle simply wires those targets into the container. There is no Eloquent or query-builder compiler, so filtering Eloquent models means writing a custom compiler or falling back to in-memory evaluation. If query pushdown matters to your use case, budget for that custom work up front.
- How do I register a custom RulerZ operator?
- In Symfony you tag a service with the bundle's operator tag and its compiler pass registers it automatically. In Laravel you would register the operator explicitly on the RulerZ engine inside your service provider, ideally from config so it stays swappable per environment. Either way the operator is a small class implementing RulerZ's Operator interface.
- Is kphoen/rulerz-bundle still maintained and safe to use in production?
- The last release was 2016-06-11, with roughly 37 stars and no dependents, which is the profile of an abandoned integration shim. Expect PHP 8 incompatibilities, Symfony 4+ dependency-injection changes and unconstrained transitive pins that fight a modern composer.lock. The MIT license removes legal friction but not the maintenance burden. If you adopt the core library instead, pin it exactly, run your suite on every PHP minor upgrade and own the fork.
- Can end users safely author their own RulerZ rules?
- The DSL parser feeds directly into the DQL and Elasticsearch compilers, so user-authored rule strings become an injection surface unless they are validated. Whitelist operators, restrict which fields may be referenced and never interpolate raw input into compiled queries. Model trusted, reusable rules as Specification classes instead of storing free-form strings.
- How do I test RulerZ rules in a Laravel test suite?
- Because rules resolve to plain PHP or DSL strings, the in-memory array compiler lets you assert behaviour in ordinary PHPUnit or Pest tests without touching a database. Specification classes are especially easy to cover since each one is a small, isolated unit of logic. The bundle adds nothing for testing, so dropping it costs you no harness.