Fantastique

An unopinionated, and labour intensive, static website generator for PHP. Allows developers to have all the flexibility they need to create any kind of static web site as if it were a classic PHP project.

This framework was developed to convert this website to static, so this already is a great showcase of the capabilities of this project, although in May of 2025 the site was brought back to a dynamic PHP website and is no longer using the framework.

motivation

The motivation for building this static site generator was simple. PHP is one of the most versatile ways of templating and quickly composing websites, but most of the time we only need it for simple things that can be static.

This tiny module aims at creating a simple way to use PHP to create static websites while maintaining the greatest amount of flexibility possible.

example usage

Using this microframework is extremely simple, and only requires the knowledge of 3 methods. copy_static, which simply copies assets and already static objects into the website build directory. render_page, which renders a PHP file into a static HTML page, and it's recursive brother render_folder, which does the same, but on an entire folder structure.

Here's an exerpt from the generate_example.php that's included in the repository of the project, which contains the full example of how to use the framework and its features:

use \Fantastique\Builder;

// Get our builder helper.
$builder = new Builder(__DIR__ . '/example', __DIR__ . '/build');

// Copy over everything from the static directory.
$builder->copy_static(__DIR__ . '/static');

// Render the example folder.
$builder->render_folder(__DIR__ . '/example', true, ['context.php']);
$builder->render_page($builder->base_path . '/context.php', [
	'something' => 'extra context!'
]);

download