quintenmbusiness / php-ast-code-generation-helper
A PHP library for generating Abstract Syntax Tree (AST) nodes programmatically, simplifying code generation with nikic/php-parser.
Requires
- php: >=8.2 < 8.4
- nikic/php-parser: ^5.3
- phpunit/phpunit: ^11.0.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.65
- phpstan/phpstan: ^2.0
This package is auto-updated.
Last update: 2024-12-15 00:55:33 UTC
README
Introduction
php-ast-code-generation-helper
is a utility package designed to simplify working with the abstract syntax trees (ASTs) generated by nikic/php-parser. This package provides helper functions to streamline code generation, allowing developers to create PHP code programmatically with ease.
Whether you're building a code generation tool, refactoring engine, or educational AST visualization tool, this package has you covered!
Features
- 🛠Simplified AST Node Creation: Generate PHP classes, methods, properties, and more using intuitive helper methods.
- 🚀 Nikic PHP-Parser Integration: Seamlessly integrates with the AST generated by
nikic/php-parser
. - 📜 Readable and Maintainable Code: Focus on what to generate, not how to build the AST nodes.
- 🧩 Customizable: Extend and customize the helpers to suit your project requirements.
Installation
Install the package via Composer:
composer require quintenmbusiness/php-ast-code-generation-helper
For development environments:
composer require --dev quintenmbusiness/php-ast-code-generation-helper
Usage
For complete details and advanced examples, check out the Wiki.
Stats
Packagist Statistics
Contributing
We welcome contributions! Please submit a pull request or open an issue for any bugs or features you'd like to see.
- Fork the repository.
- Create your feature branch:
git checkout -b feature/your-feature
. - Commit your changes:
git commit -am 'Add new feature'
. - Push to the branch:
git push origin feature/your-feature
. - Open a pull request.
Support
If you find this package useful, consider supporting its development:
Acknowledgments
- Thanks to nikic/php-parser for the excellent AST parsing library.