PHP code example of faimmedia / static-builder

1. Go to this page and download the library: Download faimmedia/static-builder library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

faimmedia / static-builder example snippets




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