PHP Class RainLab\Builder\Classes\FilesystemGenerator
Example - generate a plugin directory containing the plugin.php file.
The file is created from a template, which uses a couple of variables.
$structure = [
'author',
'author/plugin',
'author/plugin/plugin.php' => 'plugin.php.tpl'
];
$generator = new FilesystemGenerator('$', $structure, '$/Author/Plugin/templates/plugin');
$variables = [
'namespace' => 'Author/Plugin'
];
$generator->setVariables($variables);
$generator->generate();
显示文件
Open project: rainlab/builder-plugin
Class Usage Examples
Protected Properties
Public Methods
Protected Methods
Method Details
__construct()
public method
public __construct ( string $destinationPath, array $structure, string $templatesPath = null ) |
$destinationPath |
string |
Destination path to create the filesystem objects in.
The path can contain filesystem symbols. |
$structure |
array |
Specifies the structure as array. |
$templatesPath |
string |
Path to the directory that contains file templates.
The parameter is required only in case any files should be created. The path can
contain filesystem symbols. |
makeDirectory()
protected method
makeFile()
protected method
protected makeFile ( $filePath, $templateName ) |
setVariable()
public method
setVariables()
public method
Property Details
$destinationPath protected_oe property
protected $destinationPath |
$structure protected_oe property
$templatesPath protected_oe property
$variables protected_oe property