qpautrat / reactjs-php-bundle
Render ReactJS component in server side using reactjs/react-php-v8js
Installs: 57
Dependents: 0
Suggesters: 0
Security: 0
Stars: 28
Watchers: 4
Forks: 1
Open Issues: 3
Type:symfony-bundle
Requires
- reactjs/react-php-v8js: dev-master
- symfony/config: ~2.0
- symfony/dependency-injection: ~2.0
- symfony/http-kernel: ~2.0
- symfony/templating: ~2.0
Suggests
- twig/twig: Allow to use twig templating engine
This package is auto-updated.
Last update: 2024-10-12 03:44:52 UTC
README
Render ReactJS components in server side using reactjs/react-php-v8js
Prerequisites
Installation
composer require qpautrat/reactjs-php-bundle
Whitelist following library in require section until maintainers release a version on packagist
"reactjs/react-php-v8js": "*@dev"
Register the bundle in your AppKernel
new QPautrat\ReactjsPhpBundle\ReactjsPhpBundle()
Configuration
Add in your config.yml
file
reactjs_php: library_path: path_to_reactjs_library app_path: path_to_app_components
Usage
Use helper with php engine
<?php echo $view['reactjs']->renderMarkup('Component', array('foo' => 'bar')) ?> <?php echo $view['reactjs']->renderJS('Component', '#dom_element', array('foo' => 'bar')) ?>
Or you can use our twig extension as well
{{ 'Component'|reactjs_render_markup({'foo':'bar'}) }} {{ 'Component'|reactjs_render_js('#component', {'foo':'bar'}) }}
Demo
We provide a small demo application in another repository, living in a docker container, that you can use to test.
License
This bundle is available under the MIT License