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();