leunggamciu / blade
A view package extracted from laravel that does not depend on laravel
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/leunggamciu/blade
Requires
- php: ^7.1.3
Requires (Dev)
- mockery/mockery: ~1.0
- phpunit/phpunit: ~7.0
This package is auto-updated.
Last update: 2025-12-24 07:56:36 UTC
README
Introduction
Blade is a template engine extracted from illuminate/view. It drops all laravel related stuff, so that
we could use it as a common composer package in many cases.
Limitations
Since all laravel related stuff was droped, there are a few limitations when compared to the origin:
- no helper directives:
@dd,@dump,@method,@csrf - no translation directive:
@lang - no authentication directives:
@auth,@elseauth,@endauth,@guest,@elseguest,@endguest - no authorization directives:
@can,@elsecan,@endcan,@cannot,@elsecannot,@endelsecannot - no service injection directive:
@inject - no
withmagic like:withError(), butwith()is still available - no auto dependency injection in class style composer callback, because we drop the IoC container
Usage
<?php use Blade\Engines\EngineResolver; use Blade\Engines\{CompilerEngine, PhpEngine, FileEngine}; use Blade\Compilers\BladeCompiler; use Blade\Filesystem\Filesystem; use Blade\Events\Dispatcher; use Blade\ViewFinder; use Blade\Factory; $engineResolver = new EngineResolver; $engineResolver->register('file', function() { return new FileEngine; }); $engineResolver->register('php', function() { return new PhpEngine; }); $engineResolver->register('blade', function() { $compiler = new BladeCompiler(new Filysystem, __DIR__ . '/compiled'); return new CompilerEngine($compiler); }) $viewFinder = new ViewFinder(new Filysystem, [__DIR__ . '/views']); $eventDispatcher = new Dispatcher; $factory = new Factory($engineResolver, $viewFinder, $eventDispatcher); $factory->make('foo');