PHP Code Generator: Generate PHP code elements programatically

Recommend this page to a friend!
  Info   Documentation   View files (52)   Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
73%Total: 385 All time: 6,574 This week: 308
Version License PHP version Categories
php-generator 1.0.10MIT/X Consortium ...5.3.3PHP 5, Libraries, Code Generation
Description Author

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.

Innovation Award
PHP Programming Innovation award nominee
September 2015
Number 8


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.

Manuel Lemos
Picture of WsdlToPhp
  Performance   Level  
Name: WsdlToPhp <contact>
Classes: 9 packages by
Country: France France
Age: 36
All time rank: 78830 in France France
Week rank: 261 13 in France France
Innovation award
Innovation award
Nominee: 5x

Winner: 1x

Details

PhpGenerator, a Real PHP source code generator

> PhpGenerator helps generating PHP source code

License Latest Stable Version Build Status Scrutinizer Code Quality Code Coverage StyleCI SensioLabsInsight

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.

Main features

This project contains two main features:

  • Element: generate basic elements
  • Component: generate structured complex elements

Unit tests

You can run the unit tests with the following command:

$ cd /path/to/src/WsdlToPhp/PhpGenerator/
$ composer install
$ composer test
  Files  
File Role Description
.docker (1 file)
src (2 directories)
tests (1 file, 3 directories)
.editorconfig Data Auxiliary data
.php_cs Aux. Auxiliary data
.travis.yml Data Auxiliary data
CHANGELOG.md Data Auxiliary data
composer.json Data Auxiliary data
docker-compose.yml Data Auxiliary data
LICENSE Lic. License text
phpunit.xml.dist Data Auxiliary data
README.md Doc. Documentation

  Files  /  .docker  
File Role Description
   Dockerfile Data Auxiliary data

  Files  /  src  
File Role Description
Component (6 files)
Element (16 files)

  Files  /  src  /  Component  
File Role Description
   AbstractComponent.php Class Class source
   GenerateableInterface.php Class Class source
   PhpClass.php Class Class source
   PhpFile.php Class Class source
   PhpInterface.php Class Class source
   README.md Doc. Documentation

  Files  /  src  /  Element  
File Role Description
   AbstractAccessRestrictedElement.php Class Class source
   AbstractAssignedValueElement.php Class Class source
   AbstractElement.php Class Class source
   GenerateableInterface.php Class Class source
   PhpAnnotation.php Class Class source
   PhpAnnotationBlock.php Class Class source
   PhpClass.php Class Class source
   PhpConstant.php Class Class source
   PhpFile.php Class Class source
   PhpFunction.php Class Class source
   PhpFunctionParameter.php Class Class source
   PhpInterface.php Class Class source
   PhpMethod.php Class Class source
   PhpProperty.php Class Class source
   PhpVariable.php Class Class source
   README.md Doc. Documentation

  Files  /  tests  
File Role Description
Component (4 files)
Element (11 files)
resources (4 files)
   TestCase.php Test Unit test script

  Files  /  tests  /  Component  
File Role Description
   AbstractComponent.php Test Unit test script
   PhpClassTest.php Test Unit test script
   PhpFileTest.php Test Unit test script
   PhpInterfaceTest.php Test Unit test script

  Files  /  tests  /  Element  
File Role Description
   PhpAnnotationBlockTest.php Test Unit test script
   PhpAnnotationTest.php Test Unit test script
   PhpClassTest.php Test Unit test script
   PhpConstantTest.php Test Unit test script
   PhpFileTest.php Test Unit test script
   PhpFunctionParameterTest.php Test Unit test script
   PhpFunctionTest.php Test Unit test script
   PhpInterfaceTest.php Test Unit test script
   PhpMethodTest.php Test Unit test script
   PhpPropertyTest.php Test Unit test script
   PhpVariableTest.php Test Unit test script

  Files  /  tests  /  resources  
File Role Description
   PhpClassTest_SimpleToString.php Test Unit test script
   PhpFileTest_SimpleClassToString.php Test Unit test script
   PhpFileTest_SimpleInterfaceToString.php Test Unit test script
   PhpInterfaceTest_SimpleToString.php Test Unit test script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:385
This week:0
All time:6,574
This week:308
 User Ratings  
 
 All time
Utility:93%
Consistency:93%
Documentation:81%
Examples:-
Tests:87%
Videos:-
Overall:73%
Rank:230
  

For more information send a message to info at phpclasses dot org.