This WordPress bundle configures the standalone snicco/blade-bridge
library for usage in applications based on snicco/kernel
.
composer install snicco/blade-bundle
This bundle has no configuration options currently.
Add the TemplatingBundle
and the BladeBundle
to your bundles.php
config file.
<?php
// /path/to/configuration/bundles.php
use Snicco\Bundle\Blade\BladeBundle;
use Snicco\Bundle\Templating\TemplatingBundle;
return [
'bundles' => [
Snicco\Component\Kernel\ValueObject\Environment::ALL => [
TemplatingBundle::class,
BladeBundle::class
]
]
];
You can now render .blade.php
with the TemplateEngine
that is bound in the kernel container.
use Snicco\Component\BetterWPDB\BetterWPDB;
use Snicco\Component\Kernel\Kernel;
use Snicco\Component\Templating\TemplateEngine;
/**
* @var Kernel $kernel
*/
$kernel->boot();
$template_engine = $kernel->container()->make(TemplateEngine::class);
// Assuming you have a welcome.blade.php view
$template_engine->renderView('welcome', ['greet' => 'Calvin']);
The BladeBundle
reconfigures a couple of the disabled blade directives:
@auth
can be used to check if the current WordPress user is logged in.@guest
can be used to check if the current WordPress user is logged out.@role
can be used to check a role of the current WordPress user, e.g.@role(editor)
This repository is a read-only split of the development repo of the Snicco project.
This is how you can contribute.
Please report issues in the Snicco monorepo.
If you discover a security vulnerability within BetterWPCache, please follow our disclosure procedure.