polidog / ssr-bundle
There is no license information available for the latest version (1.0.0) of this package.
A JavaScript server side rendering for Symfony
1.0.0
2017-02-22 18:16 UTC
Requires
- php: ~5.6|~7.0
- koriym/baracoa: 1.x-dev
- sabre/cache: ^1.0
- sensio/framework-extra-bundle: ~2.7|~3.0
- symfony/framework-bundle: ~2.7|~3.0
Requires (Dev)
- phpunit/phpunit: ^6.0
This package is auto-updated.
Last update: 2024-12-21 20:30:50 UTC
README
JavaScript server side rendering (SSR) bundle for Symfony.
Inspected by bearsunday/BEAR.SsrModule
Prerequisites
- php7.1
- V8Js (Optional)
- Symfony3.3~
Installation
$ composer require polidog/ssr-bundle "^1.0"
Usage
Enable the bundle
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Polidog\SsrBundle\SsrBundle(), // ... ); }
Configuration in config.yml:
polidog_ssr:
bundle_src_path: "%kernel.root_dir%/../web/js"
Controller Annotation.
// 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.
/**
* @Route("/", name="homepage")
* @Ssr(
* app="index_ssr",
* state={"hello"},
* metas={"title"},
* cache=true
* )
*/