Download the PHP package pinkcrab/bladeone-engine without Composer
On this page you can find all versions of the php package pinkcrab/bladeone-engine. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pinkcrab/bladeone-engine
More information about pinkcrab/bladeone-engine
Files in pinkcrab/bladeone-engine
Package bladeone-engine
Short Description An implementation of the PinkCrab Renderable Interface used in the PinkCrab Plugin Framework V2+.
License MIT
Homepage https://pinkcrab.co.uk
Informations about the package bladeone-engine
BladeOne_Engine
A BladeOne Engine for the PinkCrab Renderable Interface.
Supports and tested with the PinkCrab Perique Framework versions 2.0.*
Why?
The BladeOne implementation of the Renderable interface, allows the use of Blade within the PinkCrab Framework.
Setup
`
Out of the box, you can just include the BladeOne module when you are booting Perique and you will have full access to the BladeOne engine.
By default the following are assumed
path/to/project/root/views
as the view pathpath/wp-content/uploads/blade-cache
as the cache pathMODE_AUTO
Usage
Just like the native PHP_Engine found with Perique, you can inject the View service into any class and use it to render a view.
The above would render the template path/to/project/root/views/some/path/view_name.blade.php
with access to $data in the view which would be to pass
.
Would render as
It is fully possible to make use of the template inheritance and other blade features.
Configuring BladeOne
As with all other modules, BladeOne can be configured by passing a \Closure
as the 2nd argument to the module()
method.
Compact BladeOne Config
It is possible to do the Module config in a much more concise fashion, using the fluent API and PHP Arrow functions
You can also hold the config in its own class and use that.BladeOne_Module Config
You can call the following methods on the BladeOne Module to configure the BladeOne Module.
- template_path
- compiled_path
- mode
- comment_mode
- config
BladeOne_Engine Config
You can call the following methods on the BladeOne_Engine to configure the BladeOne_Engine.
- allow_pipe
- directive
- directive_rt
- add_include
- add_class_alias
- share
- set_file_extension
- set_compiled_extension
- set_esc_function
Blade Templating
Most Blade features are present, to see the full docs please visit the EFTEC/BladeOne wiki
- Echo data unescaped
- Call PHP Function
- Running PHP Block
- Conditionals
- if, elseif, else
- switch
- Loops
- for
- foreach
- forelse
- while
- include
- form
- auth
- permissions
Included Components
Out of the box PinkCrab_BladeOne comes with the BladeOneHTML trait added, giving access all HTML components.
- BladeOneHTML
- viewModel
- viewComponent
- nonce
Magic Call Methods
The BladeOne class has a large selection of Static and regular methods, these can all be accessed from BladeOne_Engine. These can be called as follows.
The can also be called in templates.
For the complete list of methods, please visit https://github.com/EFTEC/BladeOne/wiki/Methods-of-the-class
Static Access
calling
engine()
on view, will return the underlying rendering engine used, in this casePinkCrab_BladeOne
.Of course you can set the engine it self as a global variable using
$provider->share('view_helper', [App::view(), 'engine'])
. Then you can use{$view_helper->some_method(\$data)}
in your view.
Extending
It is possible to extend BladeOne via other plugins, if you would like to add additional functionality by adding custom directives, or adding additional methods to the BladeOne_Engine class. You can do this by using the PinkCrab_BladeOne::SETUP_CONFIG
action and add any additional configs such as directives.
Dependencies
Requires
License
MIT License
http://www.opensource.org/licenses/mit-license.html
Previous Perique Support
- For support of all versions before Perique V2, please use the BladeOne_Provider
Change Log
- 2.1.0 - Updated to support Perique V2.1.x -- Please note version number jumped to match rest of Perique Framework --
- 1.1.0 - Provides BladeOne 4.12+ and BladeOneHTML 2.4+. With comment mode support.
- 1.0.1 - Last version to support pre 4.12 BladeOne (will be the last)
- 1.0.0 - Migrated over from the Perique V2 Prep branch of BladeOne_Provider.
- New Features
- Auth and Permissions now hooked up and based on the current user.
- Perique V2 Module structure.
- WP Nonce support.
All versions of bladeone-engine with dependencies
pinkcrab/perique-framework-core Version 2.1.*
eftec/bladeone Version >=4.12
eftec/bladeonehtml Version >=2.4
pinkcrab/function-constructors Version 0.2.*