dev-master
9999999-devLaravel Blade template engine as a standalone component
MIT
The Requires
- php >=5.4
- illuminate/view ~5.0
- illuminate/events ~5.0
The Development Requires
by atijust
laravel templating template blade view
Laravel Blade template engine as a standalone component
Laravel Blade template engine as a standalone component., (*2)
make('index', ['message' => 'Hello, world!'])->render(); ``` ## Installation Require this package in your composer.json and run composer update command. ```json { "require": { "atijust/ronin-blade": "dev-master@dev" } } ``` ## Usage `\Ronin\Blade::make()` returns a instance of `Illuminate\View\Factory`. ```php $blade = Ronin\Blade::make(__DIR__ . '/views', __DIR__ . '/cache'); echo get_class($blade); // => Illuminate\View\Factory ``` You can use all blade features. ```php // Add a piece of shared data to the environment. $blade->share('defaultTitle', 'Ronin Blade'); // Register a view composer event. $blade->composer('index', 'IndexViewComposer'); // Register a handler for custom directives. $blade->getEngineResolver()->resolve('blade')->getCompiler()->directive( 'datetime', function($expression) { return "format('m/d/Y H:i'); ?>"; } ); // Get the evaluated view contents for the given view. $view = $blade->make('index');
By default, view composer and view creater are resolved by the ronin's internal container. If you want to use your own container, set the third parameter of \Ronin\Blade::make()
to any container you like., (*3)
$container = new \Illuminate\Container\Container(); $container->singleton('IndexViewComposer', function () { return new IndexViewComposer(); }); $blade = \Ronin\Blade::make(__DIR__ . '/views', __DIR__ . '/cache', $container); $blade->composer('index', 'IndexViewComposer'); // Resolved by $container
Ronin Blade is open-sourced software licensed under the MIT license., (*4)
Laravel Blade template engine as a standalone component
MIT
laravel templating template blade view