PHP code example of camspiers / reactjs-php-render

1. Go to this page and download the library: Download camspiers/reactjs-php-render 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/ */

    

camspiers / reactjs-php-render example snippets


$node = ReactJS\ReactFactory::createUsingNode(
	'/usr/bin/nodejs',
	['bundle.js'] // bundle.js is a browserified bundle with React and TestComponent
);

echo $node->renderAutoMountingComponent('./TestComponent');

$v8 = ReactJS\ReactFactory::createUsingV8(
	['bundle.js'] // bundle.js is a browserified bundle with React and TestComponent
);

echo $v8->renderAutoMountingComponent('./TestComponent');