nicoswd/php-rule-parser
A lightweight PHP parser for validation-style rule strings, turning expressions like required|max:255 into structured rule objects with names and parameters. Useful for custom validators, form/request tooling, or inspecting Laravel-style rules without a full framework.
eval(). Compared with ad-hoc eval()-based approaches common in PHP codebases, a dedicated parser reduces security exposure and gives a clearer audit boundary — a decision that directly affects security posture and compliance review.Good fit:
eval()) as a security and audit improvement.Look elsewhere or proceed with caution:
For executives: We have recurring product needs — pricing logic, promotions, eligibility, scoring — that currently require engineering changes and releases every time a threshold or condition shifts. This package gives us a proven pattern for expressing those rules as configurable expressions instead of code. It reduces time-to-market for rules-driven features, removes routine change requests from the engineering backlog, and lets business teams respond to the market faster. It's MIT-licensed and small, so cost of adoption is low; the main risk is maintainer maturity, which we'll mitigate with a security review and an internal abstraction layer so we're not locked in.
For engineering: This is a PHP expression parser/evaluator — a sandboxed alternative to eval() and to hand-rolling a DSL. Recommendation is to adopt behind our own RuleEvaluator interface so the dependency stays swappable, with parsed expressions cached to control overhead. Before rollout we need: (1) source and test-suite review, given limited community signal, (2) a security pass confirming the expression sandbox cannot invoke arbitrary functions or side effects, and (3) a small benchmark on our hot paths. If any of those fail, we fall back to a maintained rules service or a thin in-house parser — the interface boundary means that decision is reversible.
How can I help you explore Laravel packages today?