PHP code example of polidog / ssr-bundle

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

    

polidog / ssr-bundle example snippets



// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Polidog\SsrBundle\SsrBundle(),
        // ...
    );
}

// src/AppBundle/Controller/DefaultController.php



namespace AppBundle\Controller;

use Polidog\SsrBundle\Annotations\Ssr;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class DefaultController extends Controller
{
    /**
     * @Route("/", name="homepage")
     * @Ssr(
     *     app="index_ssr",
     *     state={"hello"},
     *     metas={"title"}
     * )
     */
    public function indexAction()
    {
        return [
            'hello' => [
                'name' => 'polidog',
            ],
            'title' => 'polidog lab'
        ];
    }
}