ocramius/code-generator-utils
A small toolkit of utilities that simplifies programmatic PHP code generation. It offers helpers for building class and method definitions, sanitizing identifiers, and producing unique names—handy when writing proxy generators, scaffolding tools, or anything that emits PHP source at runtime.
Inflector (class/trait/interface name rewriting), GeneratorStrategy (EvaluatingGeneratorStrategy for eval-based generation, SavingGeneratorStrategy for writing to disk), FileLocator and Autoloader helpers — that make nikic/php-parser and Reflection cooperate. That is exactly the layer you would otherwise spec from scratch when a feature needs generated PHP classes. Using it as a reference design shortens the estimate for "do we build our own proxy/scaffolding layer?" from weeks to days.ocramius/proxy-manager and its LTS fork). If any roadmap item depends on runtime proxy generation, this is on your critical path — and it is archived, which is a roadmap input, not a footnote.laminas-code or php-parser, this tells you how cheaply the two can be bridged.Adopt (or, realistically, borrow) it when:
Look elsewhere when:
laminas/laminas-code, nette/php-generator, or nikic/php-parser directly.To executives: A small, MIT-licensed PHP utility library that sits underneath runtime code generation — the machinery behind proxies and generated classes. It is ~100 stars, zero downstream dependents, and archived, so my recommendation is not to adopt it as a dependency. Its value is as a free reference design: it de-risks one of our build-vs-buy questions and lets us avoid inventing an internal codegen layer. Cost of the decision: near zero. Risk if we mistakenly standardize on it: an unmaintained component in the platform contract.
To engineering: It is the glue between php-parser and Reflection — inflection, generator strategies, file location, autoloading. If we need generated classes, this is the shortest path to a working prototype: eval-based for dev, disk-based for opcache/preload. Treat it as a spec, not a dependency: if we actually ship codegen, vendor the pieces we need or go straight to laminas-code / php-parser, which are maintained. Flag any existing transitive usage for a fork-and-own plan.
How can I help you explore Laravel packages today?