Weave 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

Rulerz Laravel Package

kphoen/rulerz

RulerZ is a PHP rule engine for writing business rules and specifications in a readable, dedicated language, then applying them to arrays, Doctrine, Elasticsearch, or Laravel models—keeping filtering logic reusable, testable, and out of your controllers.

View on GitHub
Deep Wiki
Context7

Powerful implementation of the Specification pattern in PHP

Frequently asked questions about Rulerz
What is RulerZ and how does it fit into a Laravel application?
RulerZ is a standalone PHP rule engine that implements the specification pattern. You write rules in a readable DSL and compile them to filter arrays, Doctrine queries, Elasticsearch, or Laravel models. In Laravel it can centralize business rules behind a service, but you must wire it into a service provider yourself.
How do I install RulerZ in a Laravel application?
Install it via Composer using the package name kphoen/rulerz. It is not a first-class Laravel package, so expect to build the service provider, configuration, and Eloquent adapter integration yourself. Verify PHP and Laravel compatibility before committing.
Does RulerZ support Laravel Eloquent models?
RulerZ has an Eloquent target adapter, but the evaluation flags Eloquent support as the critical unknown. Compatibility with current Laravel and PHP versions, query builder internals, relationships, soft deletes, and global scopes must be proven with a spike. Do not assume it works unchanged on your stack.
Can RulerZ apply the same rule to arrays and database queries?
Yes, that is the core value: one rule can target arrays or Traversable, Doctrine, Eloquent, and Elasticsearch. However, the array adapter and SQL adapter can diverge on nulls, dates, enums, case sensitivity, and relationships. Use contract tests per rule family to catch semantic drift.
Is RulerZ a good fit for user-defined rules or admin-editable rules?
It can be, but user-authored rules turn the DSL into an untrusted input surface. You would need validation, versioning, approvals, query cost limits, and protection against expensive queries or field exposure. RulerZ is a library, not a full BRMS, so those controls are your responsibility.
What are the main production risks with RulerZ?
The primary risk is maintenance: modest popularity, zero reported dependents, and a likely single maintainer mean abandonment is plausible. Framework compatibility risk is also real because an aging Eloquent adapter can break on Laravel upgrades. Debuggability, opaque generated SQL, and semantic drift between targets also need mitigation.
How should I test RulerZ rules in a Laravel app?
Write contract tests for each rule family against every target you support. Test edge cases such as nulls, dates, enums, case sensitivity, relationships, soft deletes, and global scopes. Also test parser errors and generated query behavior so production support is not blind.
How do I debug the SQL generated by RulerZ?
RulerZ compiles rules to the target query language, so generated SQL can be opaque. Add rule validation, clear parser error messaging, and query logging before production. Keep rules behind an internal RuleEngine interface so you can inspect and swap behavior.
What alternatives to RulerZ should I consider for Laravel?
Alternatives include Laravel's query builder, Spatie query builder, Symfony ExpressionLanguage, or hand-written Specification classes. The evaluation frames the decision as adopting an OSS specification layer versus building a thin in-house one. RulerZ makes sense when rules are reused across multiple surfaces and change on a business cadence.
Is RulerZ actively maintained and safe to depend on?
The evaluation flags maintenance risk: 876 stars, zero dependents in the dataset, and a modest overall score. Check the last release, commit cadence, open-issue age, PHP constraints, and test coverage before adopting. The MIT license allows forking or vendoring, but that turns the OSS dependency into an internal maintenance line item.
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.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource