2017 © Pedro Peláez
 

library ssr-bundle

A JavaScript server side rendering for Symfony

image

polidog/ssr-bundle

A JavaScript server side rendering for Symfony

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

PolidogSsrBundle

Build Status Scrutinizer Code Quality, (*1)

JavaScript server side rendering (SSR) bundle for Symfony.
Inspected by bearsunday/BEAR.SsrModule, (*2)

Prerequisites

  • php7.1
  • V8Js (Optional)
  • Symfony3.3~

Installation

$ composer require polidog/ssr-bundle "^1.0"

Usage

Enable the bundle, (*3)

<?php
// app/AppKernel.php

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

Configuration in config.yml:, (*4)

polidog_ssr:
    bundle_src_path: "%kernel.root_dir%/../web/js"

Controller Annotation., (*5)

// src/AppBundle/Controller/DefaultController.php

<?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'
        ];
    }
}

Using CacheBaracoa

Set Annotation cache parameter., (*6)

$xslt /** * @Route("/", name="homepage") * @Ssr( * app="index_ssr", * state={"hello"}, * metas={"title"}, * cache=true * ) */, (*7)

The Versions

11/08 2017
22/02 2017

1.0.0

1.0.0.0

A JavaScript server side rendering for Symfony

  Sources   Download

The Requires

 

The Development Requires