PHP code example of chris13 / front-render-bundle

1. Go to this page and download the library: Download chris13/front-render-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/ */

    

chris13 / front-render-bundle example snippets



// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new Chris\Bundle\FrontRenderBundle\FrontRenderBundle(),
        );

        // ...
    }

    // ...
}



namespace AppBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class DefaultController extends Controller
{
    /**
     * @Route("/", name="homepage")
     */
    public function indexAction(Request $request)
    {
        $frontRender = $this->get('front_render_bundle.front_render');

        //Optional
        $frontRender
            ->setParameters(
            [
                'param' => 'param',
            ]
        );

        return new Response($frontRender->render());
    }
}