Download the PHP package fiskhandlarn/blade without Composer
On this page you can find all versions of the php package fiskhandlarn/blade. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package blade
blade
A library for using Laravel Blade templates in WordPress/WordPlate.
Installation
Require this package, with Composer, in the root directory of your project.
Usage
Render
Use helper function blade
:
(This renders and echoes the template /resources/views/index.blade.php
and caches it to /storage/views
.)
... or instantiate Blade
by passing the folder(s) where your view files are located, and a cache folder. Render a template by calling the render
method.
Render with data from a controller class
Use helper function blade_controller
:
(This renders and echoes the template /resources/views/index.blade.php
with data generated from App\Controllers\Index
.)
Controller classes must extend Fiskhandlarn\BladeController
.
... or use the renderController
method on a Blade
object:
You can also pass additional data (this won't override properties from the controller though):
See soberwp/controller for more info on how to use controllers.
Supported features:
Unsupported features:
Untested features:
Unnecessary features:
- Using Functions (this can be achieved with vanilla PHP)
- Template Override Option
Custom directive
Create a custom directive with helper function blade_directive
:
... or use the directive
method on a Blade
object:
Then you can use the directive in your templates:
Custom composer
Create a custom composer with helper function blade_composer
:
... or use the composer
method on a Blade
object:
Share variables
Share variables across all templates with helper function blade_share
:
... or use the share
method on a Blade
object:
Extension
The Blade
class passes all method calls to the internal compiler (see documentation) or view factory (see documentation for info on exists
, first
and creator
).
Cache
If WP_DEBUG
is set to true
templates will always be rendered and updated.
Multisite
If run on a WordPress Multisite the cached files will be separated in subfolders by each site's blog id.
Filters
Use the blade/view/paths
filter to customize the base paths where your templates are stored. (Default value is /resources/views
.)
Use the blade/cache/path
filter to customize the cache folder path. (Default value is /storage/views
.)
Use the blade/cache/path
filter to control creation of cache folder. (Default value is true
.)
Use the blade/controller/namespace
filter to customize the controller namespace. (Default value is App\Controllers
.)
License
GNU GPL 3.0+