PHP code example of norberttech / static-content-generator-bundle

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

    

norberttech / static-content-generator-bundle example snippets



// bundles.php

return [
    NorbertTech\StaticContentGeneratorBundle\StaticContentGeneratorBundle::class => ['all' => true],
];

 declare(strict_types=1);

namespace FixtureProject\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

class StaticRoutesController extends AbstractController
{
    /**
     * @Route("/parametrized/{param1}/{param2}", name="parametrized_route")
     */
    public function withParameters(string $param1, string $param2) : Response
    {
        return $this->render('parametrized.html.twig', ['param1' => $param1, 'param2' => $param2]);
    }
}



declare(strict_types=1);

namespace FixtureProject\Source;

use NorbertTech\StaticContentGeneratorBundle\Content\Source;
use NorbertTech\StaticContentGeneratorBundle\Content\SourceProvider;

final class ParametrizedSourceProvider implements SourceProvider
{
    public function all() : array
    {
        return [
            new Source('parametrized_route', ['param1' => 'first-param', 'param2' => 'second-param']),
        ];
    }
}

php -S localhost:8000 -t output