PHPackages                             angrybytes/filegen - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. angrybytes/filegen

ActiveLibrary[File &amp; Storage](/categories/file-storage)

angrybytes/filegen
==================

A PHP File and Directory Generating Tool

0.5.2(3mo ago)045.8k↓17.6%MITPHPPHP 8.2 - 8.5CI passing

Since Jul 8Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/AngryBytes/filegen)[ Packagist](https://packagist.org/packages/angrybytes/filegen)[ RSS](/packages/angrybytes-filegen/feed)WikiDiscussions 0.5 Synced 1mo ago

READMEChangelog (8)Dependencies (7)Versions (17)Used By (0)

FileGen
=======

[](#filegen)

[![PHP checks](https://github.com/AngryBytes/filegen/workflows/PHP%20checks/badge.svg)](https://github.com/AngryBytes/filegen/actions?query=workflow%3A%22PHP+checks%22)

**Note:** this is a fork of the original project as it appears to be abandoned.

A small tool to aid in the creation of (complicated) file and directory

layouts.

```
use Naneau\FileGen\Structure;
use Naneau\FileGen\Generator;

// Specify a structure to be generated
$structure = new Structure;
$structure
    ->directory('foo')
    ->file('bar/baz', 'these are the file contents');
    ->link('/some/file/somewhere', 'qux');

// Generate the structure
$generator = new Generator('/output/directory');
$generator->generate($structure);
```

will output:

```
- /output/directory/
    - foo/
    - bar/
        - baz
    - qux => /some/file/somewhere

```

Examples
--------

[](#examples)

### Copy A File

[](#copy-a-file)

Copying an existing file to a new file in the structure to be generated is easy.

```
use Naneau\FileGen\Structure;
use Naneau\FileGen\File\Contents\Copy;

$structure = new Structure;
$structure->file('foo', new Copy('/from/this/file'));
```

### Use a Twig Template

[](#use-a-twig-template)

Files can be given content using a [Twig](http://twig.sensiolabs.org/)template.

```
use Naneau\FileGen\Structure;
use Naneau\FileGen\File\Contents\Twig;

// $twig = ...

// Load a template
$template = $twig->load('some_template.twig');

// Parameters for the template
$parameters = array('foo' => 'bar')

$structure = new Structure;
$structure->file('foo', new Twig($template, $parameters));
```

### Set up A Parameter Specification Alongside A Structure

[](#set-up-a-parameter-specification-alongside-a-structure)

In some cases you'll want to specify parameters to be used by your structure beforehand. These parameters can then be queried for using the console helper (see below), and used in Twig templates.

```
use Naneau\FileGen\Generator;
use Naneau\FileGen\Structure;
use Naneau\FileGen\File\Contents\Twig;

// $twig = ...
$template = ;
$structure = new Structure;
$structure
    // A parameter "foo" is expected
    ->param('foo')

    // A bar parameter with a description
    ->param('bar', 'Please specify "bar"')

    // Can use {{ foo }} and {{ bar }}
    ->file('someFile', new Twig($twig->load('someFile.twig'));

    // Can also use {{ foo }} and {{ bar }}
    ->file('anotherFile', new Twig($twig->load('anotherFile.twig'));

// Set a default value for foo
$structure->getParameterDefinition()->get('foo')->setDefaultValue('Foo!');

// Pass values for the structure's parameters to the generator
$generator = new Generator('/output/directory', array(
    'foo' => 'foo!'
    'bar' => 12345
));

// Generate the structure
$generator->generate($structure);
```

Console Helper
--------------

[](#console-helper)

FileGen ships with a a (Symfony Console Helper\]() that will use the [built-in question helper](http://symfony.com/doc/current/components/console/helpers/questionhelper.html)to ask for parameter values.

Simply add the helper to your console helper set:

```
use Naneau\FileGen\Console\Helper\ParameterHelper;

// $application = ...
$application->getHelperSet()->set(new ParameterHelper, 'filegenParameters');
```

And use it in your commands:

```
protected function execute(InputInterface $input, OutputInterface $output)
{
    // $structure = ...

    $helper = $this->getHelper('filegenParameters');

    // Ask for all parameters one by one
    $parameters = $helper->askParameters($structure, $input, $output);

    // Ask for a single parameter
    $fooParameter = $structure->getParameterDefinition()->get('foo');
    $fooValue = $helper->askParameter($fooParameter, $input, $output);
}
```

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance79

Regular maintenance activity

Popularity28

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~281 days

Recently: every ~197 days

Total

16

Last Release

111d ago

PHP version history (7 changes)0.1.0PHP 7.2.\* || 7.3.\* || 7.4.\*

0.2.0PHP 7.3.\* || 7.4.\* || 8.0.\*

0.3.0PHP 7.4.\* || 8.0.\* || 8.1.\*

0.3.1PHP 7.4.\* || 8.0.\* || 8.1.\* || 8.2.\*

0.4.0PHP 8.1.\* || 8.2.\* || 8.3.\*

0.5.0PHP 8.2 - 8.4

0.5.1PHP 8.2 - 8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/d2d7c104d03e59c7603a91d0292e83e62454647795ffd925d11001fc6edc37c6?d=identicon)[angrybytes](/maintainers/angrybytes)

---

Top Contributors

[![t0mmie](https://avatars.githubusercontent.com/u/953495?v=4)](https://github.com/t0mmie "t0mmie (33 commits)")[![naneau](https://avatars.githubusercontent.com/u/89551?v=4)](https://github.com/naneau "naneau (22 commits)")[![stephank](https://avatars.githubusercontent.com/u/89950?v=4)](https://github.com/stephank "stephank (9 commits)")[![stephan281094](https://avatars.githubusercontent.com/u/4006802?v=4)](https://github.com/stephan281094 "stephan281094 (3 commits)")[![denniszon](https://avatars.githubusercontent.com/u/9333144?v=4)](https://github.com/denniszon "denniszon (2 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/angrybytes-filegen/health.svg)

```
[![Health](https://phpackages.com/badges/angrybytes-filegen/health.svg)](https://phpackages.com/packages/angrybytes-filegen)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.2k511.3M2.2k](/packages/aws-aws-sdk-php)[terminal42/contao-fineuploader

FineUploader bundle for Contao Open Source CMS

2052.9k4](/packages/terminal42-contao-fineuploader)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
