laminas-code
A PHP library that extends the PHP Reflection API with static code scanning and an object-oriented code generator for creating and updating PHP source, extensible to other output formats.
laminas-code's Generator component provides an object-oriented interface for generating arbitrary code, both to create new code and to update existing code. Although its included implementation targets PHP, the base classes can be extended to generate other kinds of text, such as JavaScript, configuration files or Apache vhosts.
Alongside code generation, the package extends the PHP Reflection API and adds static code scanning capabilities.
It is part of the Laminas project, distributed under the BSD-3-Clause license.