PHP Classes

PcGen: Generate PHP code from parameters

Recommend this page to a friend!
  Info   View files Documentation   View files View files (80)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 92 All time: 9,874 This week: 137Up
Version License PHP version Categories
pcgen 1.1.46GNU General Publi...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: 15 packages by
Country: Sweden Sweden
Age: ???
All time rank: 4922 in Sweden Sweden
Week rank: 312 Up3 in Sweden Sweden Down
Innovation award
Innovation award
Nominee: 6x

Documentation

[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)

PcGen

the PHP Code Generation support package

  • create PHP class / interface / trait code opt shipped with file docBlock 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 ternary or null coalesce operator expression other PHP expression constant function/method invoke(s)
  • create logic code using * control structures * ternary or null coalesce operator expressions * try/catch-blocks
  • create code for function/method return of variable/property value (scalar) fixedSourceValue ternary or null coalesce operator expression other PHP expression constant * function/method invoke(s)

More info in the PcGen [Summary].

---

Misc

The target PHP version code is, default, the current PHP version but configurable.

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

Tests are executed in `DISPLAY` mode, to alter, update _PHP_ const in top of `phpunit.xml`. Asserted PHP 7+ compability using [PHPCompatibility].

Support

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

Sponsorship

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>.

INSTALL

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';

License

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 [PHPCompatibility]:https://github.com/PHPCompatibility/PHPCompatibility


  Files folder image Files  
File Role Description
Files folder imagedocs (19 files)
Files folder imagesrc (24 files, 2 directories)
Files folder imagetest (21 files, 1 directory)
Accessible without login Plain text file autoload.php Aux. Auxiliary script
Accessible without login Plain text file changeLog.txt Doc. Documentation
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENCE Lic. License text
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  docs  
File Role Description
  Accessible without login Plain text file ArgumentDto.md Data Auxiliary data
  Accessible without login Plain text file AssignClauseMgr.md Data Auxiliary data
  Accessible without login Plain text file ChainInvokeMgr.md Data Auxiliary data
  Accessible without login Plain text file ClassMgr.md Data Auxiliary data
  Accessible without login Plain text file CommonMethods.md Data Auxiliary data
  Accessible without login Plain text file CtrlStructMgr.md Example 1.1.45
  Accessible without login Plain text file DocBlockMgr.md Data Auxiliary data
  Accessible without login Plain text file EntityMgr.md Data Auxiliary data
  Accessible without login Plain text file FcnFrameMgr.md Data Auxiliary data
  Accessible without login Plain text file FcnInvokeMgr.md Data Auxiliary data
  Plain text file FileMgr.md Class 1.1.45
  Accessible without login Plain text file ForeachMgr.md Example 1.1.45
  Accessible without login Plain text file PropertyMgr.md Data Auxiliary data
  Accessible without login Plain text file ReturnClauseMgr.md Data Auxiliary data
  Plain text file Summary.md Class Class source
  Accessible without login Plain text file TernaryNullCoalesceMgr.md Data 1.1.47
  Accessible without login Plain text file TryCatchMgr.md Example 1.1.45
  Accessible without login Plain text file VarDto.md Data Auxiliary data
  Accessible without login Plain text file VariableMgr.md Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
Files folder imageDto (3 files)
Files folder imageTraits (5 files)
  Plain text file Assert.php Class Class source
  Plain text file AssignClauseMgr.php Class Class source
  Plain text file BaseA.php Class Class source
  Plain text file BaseB.php Class Class source
  Plain text file BaseC.php Class Class source
  Plain text file CatchMgr.php Class 1.1.45
  Plain text file ChainInvokeMgr.php Class Class source
  Plain text file ClassMethodFactory.php Class Class source
  Plain text file ClassMgr.php Class Class source
  Plain text file CtrlStructMgr.php Class 1.1.45
  Plain text file DocBlockMgr.php Class Class source
  Plain text file EntityMgr.php Class Class source
  Plain text file FcnFrameMgr.php Class Class source
  Plain text file FcnInvokeMgr.php Class Class source
  Plain text file FileMgr.php Class 1.1.45
  Plain text file ForeachMgr.php Class 1.1.45
  Plain text file PcGenInterface.php Class Class source
  Plain text file PropertyMgr.php Class Class source
  Plain text file ReturnClauseMgr.php Class Class source
  Plain text file SimpleCondMgr.php Class 1.1.45
  Plain text file TernaryNullCoalesceMgr.php Class 1.1.47
  Plain text file TryCatchMgr.php Class 1.1.45
  Plain text file Util.php Class Class source
  Plain text file VariableMgr.php Class Class source

  Files folder image Files  /  src  /  Dto  
File Role Description
  Plain text file ArgumentDto.php Class Class source
  Plain text file UseSubjectDto.php Class 1.1.47
  Plain text file VarDto.php Class Class source

  Files folder image Files  /  src  /  Traits  
File Role Description
  Plain text file ArgumentTrait.php Class Class source
  Plain text file NameTrait.php Class 1.1.45
  Plain text file OperatorTrait.php Class Class source
  Plain text file ScalarTrait.php Class 1.1.45
  Plain text file SourceTrait.php Class 1.1.45

  Files folder image Files  /  test  
File Role Description
Files folder imageDto (2 files)
  Plain text file AcmDataProviderTrait.php Class Class source
  Plain text file AssignClauseMgrTest.php Class Class source
  Plain text file AssignClauseMgrTest2.php Class Class source
  Plain text file BaseATest.php Class Class source
  Plain text file BaseBTest.php Class Class source
  Plain text file BaseCTest.php Class Class source
  Plain text file ClassMgrTest.php Class Class source
  Plain text file CtrlStructMgrTest.php Class 1.1.45
  Plain text file DocBlockMgrTest.php Class Class source
  Plain text file EntityMgrTest.php Class Class source
  Plain text file FcnFrameMgrTest.php Class Class source
  Plain text file FcnInvokeMgrTest.php Class Class source
  Plain text file FileMgrTest.php Class 1.1.45
  Plain text file FimDataProviderTrait.php Class Class source
  Plain text file ForeachMgrTest.php Class 1.1.45
  Plain text file ReturnClauseMgrTest.php Class Class source
  Plain text file ReturnClauseMgrTest2.php Class Class source
  Plain text file SimpleCondMgrTest.php Class 1.1.45
  Plain text file TernaryNullCoalesceMgrTest.php Class 1.1.47
  Plain text file TryCatchMgrTest.php Class 1.1.45
  Plain text file VariableMgrTest.php Class Class source

  Files folder image Files  /  test  /  Dto  
File Role Description
  Plain text file ArgumentDtoTest.php Class Class source
  Plain text file VarDtoTest.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:92
This week:0
All time:9,874
This week:137Up