Skip to content

Render ReactJS component in server side using reactjs/react-php-v8js

Notifications You must be signed in to change notification settings

qpautrat/reactjs-php-bundle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 

Repository files navigation

reactjs-php-bundle

Render ReactJS components in server side using reactjs/react-php-v8js

Prerequisites

V8Js PHP extension

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

About

Render ReactJS component in server side using reactjs/react-php-v8js

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages