Windwalker Blade Example
A really simple working example of standalone blade templating using the Windwalker Renderer
Install dependencies via Composer
composer update
Configuration
In config.php
Enter base url for proper URL generation:
const BASE_URL = 'http://localhost';
In helpers.php
Implement any helper your template might use:
function asset($path)
{
return BASE_URL . '/assets'. $path;
}
Usage
- Put your blade files in the
views/
folder.
<h1>Welcome!</h1>
<p>
<a href="{{ url('example') }}">Example</a>
</p>
- Create a 'controller' for each page in the
pages/
folder
class Page
{
function show($renderer)
{
//Render the views/welcome.blade.php file
return $renderer->render('welcome', []);
}
}
- Access your pages by controller file name
http://localhost => pages/index.php
http://localhost/example => pages/example.php