1. Go to this page and download the library: Download patlamontagne/react-dot-php 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/ */
patlamontagne / react-dot-php example snippets
use ReactDot\Dot;
// will echo the component directly
Dot::render('Layout/NavigationBar', ['mode' => 'dark']);
// accepts functions
Dot::render('Layout/NavigationBar', [
'mode' => 'dark',
// lazy
'auth' => function() {
if ($user = user()) {
return [
'user' => $user,
];
}
},
]);
// get the resulting string
echo Dot::build('Layout/NavigationBar', ['mode' => 'dark']);