1. Go to this page and download the library: Download jumilla/source-generator 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/ */
jumilla / source-generator example snippets
use Jumilla\Generators\FileGenerator;
$generator = FileGenerator::make('outdir-path', 'stubdir-path');
# copy
$generator->sourceFile('Controller.php');
# generate in directory
$name = 'notification';
$generator->directory('Services', function ($generator) use ($name) {
$generator->file(ucfirst($name).'Service.php')->template('Service.php');
});
$generator->file('Class1.php')->blank();
$generator->file('Class1.php')->text('## read');
$generator->sourceFile('Class1.php');
$generator->file('Class2.php')->text(' class {$class_name} {}', [
'class_name' => 'Class2',
]);