hoa/compiler
Hoa\Compiler is a PHP library for building lexers and parsers from grammar definitions. It supports LL(1) and LR(1) analysis, AST manipulation, grammar validation, and compiler construction, making it easier to parse domain-specific languages and custom syntax.
hoa/compiler provides the full pipeline — lexer, LL(1)/LR(1)/LALR(1) parser generation, AST construction, and visitor traversal — so a team can define a grammar in the PP language rather than writing brittle regex or recursive-descent code.symfony/expression-language for safe expression evaluation, nikic/php-parser for PHP source, doctrine/lexer for tokenizing, or offloading to ANTLR/PEG tooling. Choosing hoa/compiler is choosing "full grammar toolkit, self-hosted," which is a materially larger commitment than any of those.Consider it when:
Look elsewhere when:
symfony/expression-language covers most Laravel cases with active maintenance and a safer evaluation sandbox.nikic/php-parser is the maintained, widely depended-on answer.To executives: This is a compiler-construction toolkit, not a Laravel component. It would let us implement a small language — rules, formulas, or a query syntax — in weeks rather than quarters, which is real leverage if that language is a product differentiator. The catch is ownership: the project was archived in 2017, has no meaningful downstream ecosystem, and will receive no upstream fixes. So the proposal is not "add a dependency," it is "adopt and maintain a frozen internal component." That is defensible for a bounded, differentiated feature and indefensible for infrastructure we expect to live for years. Recommendation: fund a timeboxed spike against a named feature, and require a written fallback before committing.
To engineering: Strong conceptual coverage — grammar-driven lexing and parsing, AST generation, and visitor-based traversal, with a mature design that predates most PHP parsing libraries. The interface is expressive and the visitor model composes well with Laravel service containers and pipeline-style processing. The risks are equally concrete: no releases since 2017, archived repository, zero dependents to inherit fixes from, and unknown PHP 8.x behavior that we would have to validate ourselves. If we proceed, treat it as a vendored fork with a named maintainer, pinned version, characterization tests around the grammar, and a documented replacement path. If the actual requirement is expression evaluation, say so early — we can solve that with a maintained library and skip this entirely.
How can I help you explore Laravel packages today?