dev-master
9999999-devA package enabling the use of Blade templating engine in PHP
Apache-2.0
The Requires
by Arsen Goian
framework blade viper
Wallogit.com
2017 © Pedro Peláez
A package enabling the use of Blade templating engine in PHP
A Blade templating language adaptation for the Viper Framework, (*1)
For Blade doc, refer to the official Laravel documentation on Blade, (*2)
May be used from the controller like this:, (*3)
namespace App\Controllers;
use Viper\Core\Routing\Controller;
use Viper\Core\Routing\Methods\GET;
use Viper\Core\Viewable;
use Blade\View;
use App\Models\Client;
class HomeController extends Controller implements GET
{
public function get (...$args): ?Viewable
{
$clients = Client::all();
return new BladeView('test', [
'folks' => $clients,
]);
}
}
Exceptions may be parsed nicely in a custom view.
By default, the error.blade.php is invoked with $e variable for exception, (*4)
use \Blade\View::bindErrorView() for configuration, (*5)
Extra variables and error preferences may be passed from a filter (official doc on filters):, (*6)
namespace App\Filters;
use Blade\View;
use Viper\Core\Filter;
class BladeFilter extends Filter
{
public function proceed ()
{
// Set up custom error reporting
if (!Config::get('DEBUG'))
View::bindErrorView('publicErrorView', 'exception');
// These variables will be visible in all the views
View::propagateVars([
'myCustomVar' => 42,
'clientHandler' => Config::get('Clients.HANDLER'),
]);
}
}
A package enabling the use of Blade templating engine in PHP
Apache-2.0
framework blade viper