|Ratings|| ||Unique User Downloads|| ||Download Rankings|
| 73%||Total: 416 ||All time: 6,388 This week: 299|
This package can generate PHP code elements programatically.
It provides a set of classes that can generate PHP code elements of different types like PHP files, classes, interfaces, functions, function patrameters, variables and annotations.
Another set of classes can generate more complex components made of base PHP code elements that are passed to these classes as object parameters.
Prize: One copy of the Zend Studio
|One common way to generate code in PHP or any other language is to use templates and replace variable values.
This package provide an alternative approach that consists in classes of objects that represent each type of construct of the PHP language, like classes, interfaces, functions, variables, etc..
It can define the PHP code you want to generate by combining language element objects in a hierarchic way.
PhpGenerator, a Real PHP source code generator
> PhpGenerator helps generating PHP source code
Even if this project is yet another PHP source code generator, its main goal is to provide a consistent PHP source code generator for the PackageGenerator project. Nevertheless, it also aims to be used for any PHP source code generation process as it generates standard PHP code.
Rest assured that it is not tweaked for the purpose of the PackageGenerator project.
This project contains two main features:
Element: generate basic elements
Component: generate structured complex elements
Testing using Docker
Thanks to the Docker image of phpfarm, tests can be run locally under any PHP version using the cli:
First of all, you need to create your container which you can do using docker-compose by running the below command line from the root directory of the project:
$ docker-compose up -d --build
You then have a container named
php_generator in which you can run
composer commands and
php cli commands such as:
# install deps in container (using update ensure it does use the composer.lock file if there is any)
$ docker exec -it php_generator php-7.4 /usr/bin/composer update
# run tests in container
$ docker exec -it php_generator php-7.4 -dmemory_limit=-1 vendor/bin/phpunit
If you have a question, feel free to create an issue.
The MIT License (MIT). Please see License File for more information.
||Applications that use this package
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.