PcGen: Generate PHP code from parameters

Recommend this page to a friend!
  Info   Documentation   View files (59)   Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2020-07-21 (15 days ago) Not yet rated by the usersTotal: 72 This week: 1All time: 9,639 This week: 255
Version License PHP version Categories
pcgen 1.0.4GNU Lesser Genera...5PHP 5, Code Generation
Description Author

This package can generate PHP code from parameters.

It provides a set classes that can generate code to create PHP scripts using many constructs supported by PHP. Currently it can:

- Create PHP classes, interfaces and traits code
- Create docBlocks based on PHPDoc
- Create PHP function and class methods
- Create definitions of local variables, class variables and constants
- Create assignments of local variables and class variables

Picture of Kjell-Inge Gustafsson
  Performance   Level  
Name: Kjell-Inge Gustafsson <contact>
Classes: 13 packages by
Country: Sweden Sweden
Age: ???
All time rank: 5333 in Sweden Sweden
Week rank: 37 1 in Sweden Sweden
Innovation award
Innovation award
Nominee: 4x


[comment]: # (This file is part of PcGen, PHP Code Generation support package. Copyright 2020 Kjell-Inge Gustafsson, kigkonsult, All rights reserved, licence GPL 3.0)


the PHP Code Generation support package

  • create PHP class / interface / trait code<br> * with namespace, use, extends, implements * with constuctor and factory methods * with constants and properties with opt. getter(+iterator) and setter methods * allow insert of (pre-produced, logic) code
  • create docBlocks * in compliance with [phpdoc]
  • create PHP function/method frame (shell) code * with arguments and closure use variables * with property(/variable) set code * with method return code * allow insert of (pre-produced, logic) code
  • create code for single or chained function/method invoke(s)
  • create define variable property/variable/constant code * with PHP primitive value, array, closure or callback
  • create code for variable/property value assign from * variable/property value * (scalar) fixedSourceValue * PHP expression * constant * function/method invoke(s)
  • create code for function/method return of * variable/property value * (scalar) fixedSourceValue * PHP expression * constant * function/method invoke(s)

More info in the PcGen [Summary].



The target PHP version code is, for now, the current PHP version.

Using a PHP reserved name as _name_ (ex FQCN/className) will thow an InvalidArgumentException.

You may need to readjust result output code style and indents.


Tests are executed in `DISPLAY` mode, to alter, update _PHP_ const in top of `phpunit.xml`.


For support use [github.com PcGen]. Non-emergence support issues are, unless sponsored, fixed in due time.


Donation using <a href="https://paypal.me/kigkonsult?locale.x=en_US" rel="nofollow">paypal.me/kigkonsult</a> are appreciated. For invoice, <a href="mailto:ical@kigkonsult.se">please e-mail</a>.


composer require kigkonsult/pcgen:dev-master

Composer, in your composer.json:

    "require": {
        "kigkonsult/pcgen": "dev-master"

Otherwise , download and acquire..

namespace Kigkonsult\PcGen;
include 'pathToSource/Kigkonsult/PcGen/autoload.php';


This project is licensed under the GPLv3 License

[Composer]:https://getcomposer.org/ [github.com PcGen]:https://github.com/iCalcreator/PcGen [phpdoc]:https://phpdoc.org [Summary]:docs/Summary.md

File Role Description
docs (14 files)
src (18 files, 2 directories)
test (15 files, 1 directory)
autoload.php Aux. Auxiliary script
changeLog.txt Doc. Documentation
composer.json Data Auxiliary data
LICENCE Lic. License text
phpunit.xml Data Auxiliary data
README.md Doc. Documentation

  Files  /  docs  
File Role Description
   ArgumentDto.md Data Auxiliary data
   AssignClauseMgr.md Data Auxiliary data
   ChainInvokeMgr.md Data Auxiliary data
   ClassMgr.md Data Auxiliary data
   CommonMethods.md Data Auxiliary data
   DocBlockMgr.md Data Auxiliary data
   EntityMgr.md Data Auxiliary data
   FcnFrameMgr.md Data Auxiliary data
   FcnInvokeMgr.md Data Auxiliary data
   PropertyMgr.md Data Auxiliary data
   ReturnClauseMgr.md Data Auxiliary data
   Summary.md Class Class source
   VarDto.md Data Auxiliary data
   VariableMgr.md Data Auxiliary data

  Files  /  src  
File Role Description
Dto (2 files)
Traits (2 files)
   Assert.php Class Class source
   AssignClauseMgr.php Class Class source
   BaseA.php Class Class source
   BaseB.php Class Class source
   BaseC.php Class Class source
   BaseR1.php Class Class source
   ChainInvokeMgr.php Class Class source
   ClassMethodFactory.php Class Class source
   ClassMgr.php Class Class source
   DocBlockMgr.php Class Class source
   EntityMgr.php Class Class source
   FcnFrameMgr.php Class Class source
   FcnInvokeMgr.php Class Class source
   PcGenInterface.php Class Class source
   PropertyMgr.php Class Class source
   ReturnClauseMgr.php Class Class source
   Util.php Class Class source
   VariableMgr.php Class Class source

  Files  /  src  /  Dto  
File Role Description
   ArgumentDto.php Class Class source
   VarDto.php Class Class source

  Files  /  src  /  Traits  
File Role Description
   ArgumentTrait.php Class Class source
   OperatorTrait.php Class Class source

  Files  /  test  
File Role Description
Dto (2 files)
   AcmDataProviderTrait.php Class Class source
   AssignClauseMgrTest.php Class Class source
   AssignClauseMgrTest2.php Class Class source
   BaseATest.php Class Class source
   BaseBTest.php Class Class source
   BaseCTest.php Class Class source
   ClassMgrTest.php Class Class source
   DocBlockMgrTest.php Class Class source
   EntityMgrTest.php Class Class source
   FcnFrameMgrTest.php Class Class source
   FcnInvokeMgrTest.php Class Class source
   FimDataProviderTrait.php Class Class source
   ReturnClauseMgrTest.php Class Class source
   ReturnClauseMgrTest2.php Class Class source
   VariableMgrTest.php Class Class source

  Files  /  test  /  Dto  
File Role Description
   ArgumentDtoTest.php Class Class source
   VarDtoTest.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:1
All time:9,639
This week:255

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