free as in freedom component to generate php code for class, file, method, property, constant, documentation

1.1.5 2015-05-20 12:12 UTC


This project aims to deliver a easy to use free as in freedom php code generator. PHPDOC-Generation is also implemented as general generation tasks like "class", "function" or "property" generation.

The build status of the current master branch is tracked by Travis CI: Build Status Latest stable

The scrutinizer status are: code quality | build status

The versioneye status is: Dependency Status

This component comes with a lot of examples as well as default factories.

Take a look on


By Hand

mkdir -p vendor/net_bazzline/php_component_code_generator
cd vendor/net_bazzline/php_component_code_generator
git clone .

With Packagist

composer require net_bazzline/php_component_code_generator:dev-master


  • no "new" inside classes ...
  • independent and configurable indention
  • no static calls
  • shipped with examples and factories
  • covered with unittests
  • open source
  • automatic phpdoc generation

Optimization Potential

  • ... but "clone"
  • currently not widely used
  • no code review by other developers so far
  • still open todo's


Thanks to apigen, the api is available in the document section or online.

Future Improvements

  • implement possibility to use some "pre defined" methods for generation
  • remove @todo's in source code
  • implement method ordering by visibility and final|!final status in ClassGenerator to get some automatic ordering of public|protected|private methods for generation
  • flavour api
  • extend trait
  • extend indention
  • implement annotation
  • implement validation
  • use symfony console and commands
    • add user interaction (ask if file should be overwritten/saved
  • what about something like that
  • implement automatically documentation (validate if this is still better than current approach)

Inspired By


  • upcomming
    • updated dependencies
  • 1.1.5 - released at 22.05.2015
    • updated dependencies
  • 1.1.4 - released at 08.02.2015
    • removed dependency to apigen
  • 1.1.3 - released at 07.01.2015
    • fixed bug in SignatureGenerator when auto generating Documentation as Interface
  • 1.1.2 - released at 07.01.2015
    • added support for InterfaceGenerator to DocumentationGenerator
  • 1.1.1 - released at 07.01.2015
    • added support for InterfaceGenerator to FileGenerator
  • 1.1.0 - released at 06.01.2015
    • added api
    • fixed a bug in class generator by creating a interface generator
      • by using a interface generator, it is now possible to create an interface that extends more than one interface
      • created a general SignatureGenerator (extended by InterfaceGenerator and ClassGenerator)
      • covered new code with unit tests
      • updated InterfaceExample
    • updated dependencies
    • migration needed
  • 1.0.1 - released at 31.08.2014
    • transfered project to bazzline
    • updated dependencies
  • 1.0.0 - released at 27.07.2014
  • 0.0.3 - released at 10.06.2014
    • fixed broken strict tests
    • fixed invalid generation of interfaces
  • 0.0.2 - released at 05.06.2014
    • fixed bug in BlockGenerator::startIndention() - now multiple calls are supported
    • added method Indention::isSetToInitialLevel();
    • fixed logical bug by replacing "addExtends" to "setExtends" since it is not allowed to extend from more than one class
  • 0.0.1 - released at 25.05.2014