PHPackages                             trq/gen - 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. [Templating &amp; Views](/categories/templating)
4. /
5. trq/gen

ActiveLibrary[Templating &amp; Views](/categories/templating)

trq/gen
=======

A very very simple static site generator using Twig

0.0.5(12y ago)11901MITPHP

Since Jun 28Pushed 12y ago6 watchersCompare

[ Source](https://github.com/trq/Gen)[ Packagist](https://packagist.org/packages/trq/gen)[ RSS](/packages/trq-gen/feed)WikiDiscussions develop Synced 4d ago

READMEChangelogDependencies (2)Versions (7)Used By (0)

Gen
===

[](#gen)

A *very* *very* simple static site generator using the Twig template engine.

I developed this *very* *very* simple static site generator specifically for generating the  web site. It is indeed, *very* *very* simple.

Installation
============

[](#installation)

The best way to install Gen is via [Composer](http://getcomposer.org/). The following, will create a composer.json file, install all dependencies and bootstrap a skeleton app.

```
composer init --require=trq/gen:0.0.1 --stability=dev -n && composer install && vendor/bin/gen -i

```

By default Gen expects to find the following structure within the source directory:

```
├── assets     - All contents are recursively copied into the destination directory. *(Optional)*
├── content    - .twig files processed, directories and .html pages produced copied into the destination.
├── extensions - Twig extensions. Any extension here is autoloaded as templates are processed. *(Optional)*
└── templates  - Contains reusable .twig template partials.

```

An Example
==========

[](#an-example)

```
├── assets
│   ├── css
│   │   ├── bootstrap-responsive.css
│   ├── js
│   │   ├── bootstrap.min.js
│   └── media
│       └── img
│           ├── banner-bg.png
├── content
│   ├── about.twig
│   ├── docs
│   │   ├── current
│   │   │   ├── index.twig
│   └── index.twig
└── templates
    ├── layout.twig

```

**Results in**:

```
├── about.html
├── assets
│   ├── css
│   │   ├── bootstrap-responsive.css
│   ├── js
│   │   ├── bootstrap.min.js
│   └── media
│       └── img
│           ├── banner-bg.png
├── docs
│   ├── current
│   │   ├── index.html
└── index.html

```

Injecting Data
==============

[](#injecting-data)

Data (variables, arrays, objects) can be injected into templates at certain levels.

Data is injected by simply creating a .php file that returns the data you want in an array.

```
