faimmedia/static-builder

There is no license information available for the latest version (v0.1.7) of this package.

PHP Static Build generator

v0.1.7 2024-03-09 12:22 UTC

This package is auto-updated.

Last update: 2024-05-09 12:44:48 UTC


README

This repository will launch a internal webserver of your PHP project, collects pages and copy files to a directory of your chosing.

Install

Install this library using composer:

composer require faimmedia/static-builder 

Example

<?php

use FaimMedia\StaticBuilder\Build;
use FaimMedia\StaticBuilder\Action\{
	CombineUrl,
	Copy,
	Url,
};

$builder = new Build([
	'target' => './dist',
	'router' => './public/router.php',
	'log'    => './cache/server.log',
]);

$builder->addAction(
	new CombineUrl(
		[
			'hostname' => 'faimmedia.nl',
			'encoding' => ['gzip', 'br'],
			'path'     => 'en',
		],
		new Url([
			'url' => 'faq',
		]),
		new Url([
			'url'    => 'not-found',
			'expect' => 404,
		]),
	),
	new Url([
		'url'  => 'file/generator',
		'save' => false,
	]),
	new Copy([
		'source' => './images',
		'path'   => 'static',
	]),
);

$builder->execute();