1. Go to this page and download the library: Download corneltek/codegen library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
corneltek / codegen example snippets
$concat = new ConcatExpr('foo1', 'bar2');
$concat // 'foo1' . 'bar2'
use CodeGen\Constant;
use CodeGen\Statement\RequireOnceStatement;
$varfile = new Constant('file.php');
$
use CodeGen\Constant;
use CodeGen\Statement\RequireStatement;
$varfile = new Constant('file.php');
$
use CodeGen\Constant;
use CodeGen\Variable;
use CodeGen\Statement\RequireStatement;
$varfile = new Variable('$file');
$
$foo = new Variable('$foo');
$ifFoo = new IfIssetStatement($foo, ['key', 'key2', 0], function() use ($foo) {
$block = new Block;
$block[] = new Statement(new AssignExpr($foo, new Constant(30)));
return $block;
});
if (isset($foo['key']['key2'][0])) {
$foo = 30;
}
use CodeGen\Generator\AccessorClassGenerator;
use CodeGen\Frameworks\Apache2\VirtualHostDirectiveGroup;
$g = new AccessorClassGenerator([
'prefix' => 'App',
]);
$appClass = $g->generate(new VirtualHostDirectiveGroup);
$appClass->generatePsr4ClassUnder('src/CodeGen/Frameworks/Apache2/');
use CodeGen\Generator\AccessorClassGenerator;
use CodeGen\Frameworks\Apache2\VirtualHostDirectiveGroup;
$g = new AccessorClassGenerator([
'namespace' => 'CodeGen\Frameworks\Apache2',
'class_name' => 'ApacheSiteConfig',
]);
$appClass = $g->generate(new VirtualHostDirectiveGroup);
$appClass->generatePsr4ClassUnder('src/CodeGen/Frameworks/Apache2/');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.