Download the PHP package tourze/php-packer-generator without Composer
On this page you can find all versions of the php package tourze/php-packer-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package php-packer-generator
PHP-Packer-Generator
The PHP-Packer-Generator is a code generation component for the PHP-Packer project, responsible for merging, optimizing, and formatting PHP code.
Features
- Code Merging: Merge multiple PHP files into a single file.
- Code Optimization: Support for code minification, comment preservation, and more.
- Output Formatting: Control the formatting and style of the generated code.
- Resource Embedding: Generate code to embed resource files.
- Highly Extensible: Support custom code optimizers and formatters.
Installation
Requirements:
- PHP >= 8.1
- Composer
Install via Composer:
Quick Start
Basic usage example:
Custom Code Generation
You can extend the code generation process by implementing your own CodeOptimizer and CodeFormatter:
Configuration
The GeneratorConfig class provides options to control code generation:
setPreserveComments(bool $preserve): Whether to keep comments.setRemoveNamespace(bool $remove): Whether to remove namespaces (useful for KPHP compatibility).setOptimizeCode(bool $optimize): Enable/disable code optimization.setLineEnding(?string $ending): Set custom line ending (e.g.,"\r\n").setIndentationSize(int $size): Set indentation size.setIndentationChar(string $char): Set indentation character (e.g., space or tab).
Advanced Usage
- Resource Embedding: Use
ResourceHolderGeneratorto generate code for resource files. - Custom Visitors: Implement your own AST visitors for advanced code transformations.
Contribution Guide
- Please submit issues and pull requests via GitHub.
- Follow PSR code style guidelines.
- Ensure all tests pass (
phpunit). - Add tests for new features.
License
MIT License. See LICENSE for details.
Changelog
See Releases for version history and upgrade notes.
All versions of php-packer-generator with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.1
tourze/php-packer-ast Version 0.0.*
psr/log Version ^3|^2|^1
nikic/php-parser Version ^5.3.0
tourze/php-packer-ast Version 0.0.*
psr/log Version ^3|^2|^1
nikic/php-parser Version ^5.3.0
The package tourze/php-packer-generator contains the following files
Loading the files please wait ...