PHP code example of glavweb / silex-static-page-generator

1. Go to this page and download the library: Download glavweb/silex-static-page-generator 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/ */

    

glavweb / silex-static-page-generator example snippets

bash
php composer.phar 
bash
#!/usr/bin/env php


set_time_limit(0);

soleApplication;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
use Glavweb\SilexStaticPageGenerator\Command\GenerateStaticPagesCommand;

$input = new ArgvInput();
$env = $input->getParameterOption(['--env', '-e'], 'dev');
$debug = !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod';

if ($debug) {
    Debug::enable();
}

$app = new Application();
$app->prepare('prod');

$console = new ConsoleApplication();

// ... register commands

$baseUrl = ''; // define the project URL in your the config file
$webDir  = realpath(__DIR__ . '/../web');

$console->add(new GenerateStaticPagesCommand(
    $app['routes'],
    $app['controllers'],
    $app['url_generator'],
    $baseUrl,           // Base URL, as example: http://my_project.com
    $webDir . '/static' // The place where will generate static pages
));

$console->run($input);
bash
php bin/console generate:static-pages