PHPackages                             pinkcrab/bladeone-engine - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. pinkcrab/bladeone-engine

ActiveLibrary[Templating &amp; Views](/categories/templating)

pinkcrab/bladeone-engine
========================

An implementation of the PinkCrab Renderable Interface used in the PinkCrab Plugin Framework V2+.

2.1.0(1y ago)0710MITPHPPHP &gt;=7.4.0CI passing

Since Mar 18Pushed 1y agoCompare

[ Source](https://github.com/Pink-Crab/BladeOne_Engine)[ Packagist](https://packagist.org/packages/pinkcrab/bladeone-engine)[ Docs](https://pinkcrab.co.uk)[ RSS](/packages/pinkcrab-bladeone-engine/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (20)Versions (22)Used By (0)

[![logo](./docs/Perique%20BladeOne%20Card.jpg "Perique BladeOne Engine")](./docs/Perique%20BladeOne%20Card.jpg)

BladeOne\_Engine
================

[](#bladeone_engine)

A BladeOne Engine for the PinkCrab Renderable Interface.

[![Latest Stable Version](https://camo.githubusercontent.com/180820e1c703f323d97ae327d5c927843eeb48ddc74ae97b3ab0e237169e58d8/68747470733a2f2f706f7365722e707567782e6f72672f70696e6b637261622f626c6164656f6e652d656e67696e652f76)](https://packagist.org/packages/pinkcrab/bladeone-engine)[![Total Downloads](https://camo.githubusercontent.com/37a157aa1582bed54e5c74a01a7cdba1bca63be9c81f7c2569ce8c95f768b258/68747470733a2f2f706f7365722e707567782e6f72672f70696e6b637261622f626c6164656f6e652d656e67696e652f646f776e6c6f616473)](https://packagist.org/packages/pinkcrab/bladeone-engine)[![License](https://camo.githubusercontent.com/4911608237c3a3d2e612645e27008ad7ecf56d86194f5298b362d9173c9a9d3d/68747470733a2f2f706f7365722e707567782e6f72672f70696e6b637261622f626c6164656f6e652d656e67696e652f6c6963656e7365)](https://packagist.org/packages/pinkcrab/bladeone-engine)[![PHP Version Require](https://camo.githubusercontent.com/2ea9eb080d119c154cb22db43e436429fec709857dfd897c58a1d02a1a319c41/68747470733a2f2f706f7365722e707567782e6f72672f70696e6b637261622f626c6164656f6e652d656e67696e652f726571756972652f706870)](https://packagist.org/packages/pinkcrab/bladeone-engine)[![GitHub contributors](https://camo.githubusercontent.com/a0b02e2b92b53bb2017443d267f15730c21f529b9be6c6881017bacee6b3ffc7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f50696e6b2d437261622f426c6164654f6e655f456e67696e653f6c6162656c3d436f6e7472696275746f7273)](https://camo.githubusercontent.com/a0b02e2b92b53bb2017443d267f15730c21f529b9be6c6881017bacee6b3ffc7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f50696e6b2d437261622f426c6164654f6e655f456e67696e653f6c6162656c3d436f6e7472696275746f7273)[![GitHub issues](https://camo.githubusercontent.com/a2e0e9c1a08120f87b7dcca99fbfeac1e5b1118f15226f088dd640174b50d65b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d7261772f50696e6b2d437261622f426c6164654f6e655f456e67696e65)](https://camo.githubusercontent.com/a2e0e9c1a08120f87b7dcca99fbfeac1e5b1118f15226f088dd640174b50d65b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d7261772f50696e6b2d437261622f426c6164654f6e655f456e67696e65)

[![WP6.3 [PHP7.4-8.2] Tests](https://github.com/Pink-Crab/BladeOne_Engine/actions/workflows/WP_6_3.yaml/badge.svg)](https://github.com/Pink-Crab/BladeOne_Engine/actions/workflows/WP_6_3.yaml)[![WP6.4 [PHP7.4-8.2] Tests](https://github.com/Pink-Crab/BladeOne_Engine/actions/workflows/WP_6_4.yaml/badge.svg)](https://github.com/Pink-Crab/BladeOne_Engine/actions/workflows/WP_6_4.yaml)[![WP6.5 [PHP7.4-8.2] Tests](https://github.com/Pink-Crab/BladeOne_Engine/actions/workflows/WP_6_5.yaml/badge.svg)](https://github.com/Pink-Crab/BladeOne_Engine/actions/workflows/WP_6_5.yaml)[![WP6.6 [PHP7.4-8.2] Tests](https://github.com/Pink-Crab/BladeOne_Engine/actions/workflows/WP_6_6.yaml/badge.svg)](https://github.com/Pink-Crab/BladeOne_Engine/actions/workflows/WP_6_6.yaml)

[![codecov](https://camo.githubusercontent.com/cd22d4c3fce123c858bcc7f09b55edbe2b8591fc3b271952eae3a54e420d3440/68747470733a2f2f636f6465636f762e696f2f67682f50696e6b2d437261622f426c6164654f6e655f456e67696e652f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d6a5979506733464f534e)](https://codecov.io/gh/Pink-Crab/BladeOne_Engine)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/dea315e5ddf24ee7b1ca05782a1c5bcc13888d550f26b4f9587c58af607772c6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f50696e6b2d437261622f426c6164654f6e655f456e67696e652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Pink-Crab/BladeOne_Engine/?branch=master)[![Maintainability](https://camo.githubusercontent.com/b831a959fdce818c15c9151419e2c72cce1ce6d6d3beee7ad7e8e6103499d11b/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f39643461336334633061336539376238646333342f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/Pink-Crab/BladeOne_Engine/maintainability)

> Supports and tested with the PinkCrab Perique Framework versions 2.0.\*

Why?
----

[](#why)

The BladeOne implementation of the Renderable interface, allows the use of Blade within the PinkCrab Framework.

Setup
-----

[](#setup)

```
$ composer require pinkcrab/bladeone-engine
```

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.

```
// Bootstrap for Perique follows as normal..
$app = ( new App_Factory('path/to/project/root') )
   ->default_config()
   ->module(BladeOne::class)
   // Rest of setup
   ->boot();
```

By default the following are assumed

- `path/to/project/root/views` as the view path
- `path/wp-content/uploads/blade-cache` as the cache path
- `MODE_AUTO`

Usage
-----

[](#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.

```
class Some_Class {

      public function __construct( View $view ) {
         $this->view = $view;
      }

      public function render_view() {
         return $this->view->render('some.path.view_name', ['data' => 'to pass']);
      }
}
```

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`.

```
{{ $data }}
```

Would render as

```
to pass
```

It is fully possible to make use of the template inheritance and other blade features.

```

   @include('partials.header')
   @yield('content')
   @include('partials.footer')

```

```
@extends('layouts.default')
@section('content')
   Some content
@stop
```

Configuring BladeOne
--------------------

[](#configuring-bladeone)

As with all other modules, BladeOne can be configured by passing a `\Closure` as the 2nd argument to the `module()` method.

```
// Bootstrap for Perique follows as normal..
$app = ( new App_Factory('path/to/project/root') )
   ->default_config()
   ->module(BladeOne::class, function( BladeOne $blade ) {
      // Module config.
      $blade
         ->template_path('path/to/custom/views')
         ->compiled_path('path/to/custom/cache'); // Fluent API for chaining.

      // Set the rendering mode.
      $blade->mode(  PinkCrab_BladeOne::MODE_DEBUG );

      // Set the comment mode.
      $blade->comment_mode( PinkCrab_BladeOne::COMMENT_RAW );

      // BladeOne_Engine config.
      $blade->config( function( BladeOne_Engine $engine  {
         // See all methods below.
         $engine
            ->set_compiled_extension('.php')
            ->directive('test', fn($e) =>'test'); // Fluent API for chaining.

         $engine->allow_pipe( false );
      });

      // Ensure you return the instance.
      return $blade;
   })
   // Rest of setup
   ->boot();
```

 Compact BladeOne ConfigIt is possible to do the Module config in a much more concise fashion, using the fluent API and PHP Arrow functions

```
$app = ( new App_Factory('path/to/project/root') )
   ->default_config()
   ->module(BladeOne::class, fn( BladeOne $blade ) => $blade
      ->template_path('path/to/custom/views')
      ->compiled_path('path/to/custom/cache')
      ->mode(  PinkCrab_BladeOne::MODE_DEBUG )
      ->comment_mode( PinkCrab_BladeOne::COMMENT_RAW )
      ->config( fn( BladeOne_Engine $engine ) => $engine
         ->set_compiled_extension('.php')
         ->directive('test', fn($e) =>'test')
         ->allow_pipe( false )
      )
   )
->boot();
```

You can also hold the config in its own class and use that.

```
/** Some Class */
class BladeOneConfig {
   public function __invoke( BladeOne $blade ): BladeOne {
      return $blade
         // The setup.
   }
}

$app = ( new App_Factory('path/to/project/root') )
   ->default_config()
   ->module(BladeOne::class, new BladeOneConfig() )
   ->boot();
```

BladeOne\_Module Config
-----------------------

[](#bladeone_module-config)

You can call the following methods on the BladeOne Module to configure the BladeOne Module.

- [template\_path](docs/BladeOne-Module.md#public-function-template_path-string-template_path-)
- [compiled\_path](docs/BladeOne-Module.md#public-function-compiled_path-string-compiled_path-)
- [mode](docs/BladeOne-Module.md#public-function-mode-int-mode-)
- [comment\_mode](docs/BladeOne-Module.md#public-function-comment_mode-int-mode)
- [config](docs/BladeOne-Module.md#public-function-configcallable-config)

BladeOne\_Engine Config
-----------------------

[](#bladeone_engine-config)

You can call the following methods on the BladeOne\_Engine to configure the BladeOne\_Engine.

- [allow\_pipe](docs/BladeOne-Engine.md#public-function-allow_pipe-bool-bool--true-)
- [directive](docs/BladeOne-Engine.md#public-function-directive-string-name-callable-handler-)
- [directive\_rt](/docs/BladeOne-Engine.md#public-function-directive_rt-string-name-callable-handler)
- [add\_include](docs/BladeOne-Engine.md#public-function-add_include-view-alias--null-)
- [add\_class\_alias](docs/BladeOne-Engine.md#public-function-add_alias_classes-alias_name-class_with_namespace-)
- [share](docs/BladeOne-Engine.md#public-function-share-stringarray-var_name-value--null-)
- [set\_file\_extension](docs/BladeOne-Engine.md#public-function-set_file_extension-string-file_extension-)
- [set\_compiled\_extension](docs/BladeOne-Engine.md#public-function-set_compiled_extension-string-file_extension-)
- [set\_esc\_function](docs/BladeOne-Engine.md#public-function-set_esc_function-callable-esc-)

Blade Templating
----------------

[](#blade-templating)

Most Blade features are present, to see the full docs please visit the [EFTEC/BladeOne wiki](https://github.com/EFTEC/BladeOne/wiki)

- Echo data [escaped](docs/Bladeone-Template-Useage.md#echo-string-escaped) or [unescaped](docs/Bladeone-Template-Useage.md#echo-string-unescaped)
- [Call PHP Function](docs/Bladeone-Template-Useage.md#calling-php-functions)
- [Running PHP Block](docs/Bladeone-Template-Useage.md#running-php-blocks)
- *Conditionals*
    - [if, elseif, else](docs/Bladeone-Template-Useage.md#if-statements)
    - [switch](docs/Bladeone-Template-Useage.md#switch-statements)
- *Loops*
    - [for](docs/Bladeone-Template-Useage.md#for-loops)
    - [foreach](docs/Bladeone-Template-Useage.md#foreach-loops)
    - [forelse](docs/Bladeone-Template-Useage.md#forelse-loops)
    - [while](docs/Bladeone-Template-Useage.md#while-loops)
- [include](docs/Bladeone-Template-Useage.md#include)
- [form](docs/Bladeone-Template-Useage.md#form)
- [auth](docs/Bladeone-Template-Useage.md#auth)
- [permissions](docs/Bladeone-Template-Useage.md#permissions)

Included Components
-------------------

[](#included-components)

Out of the box PinkCrab\_BladeOne comes with the BladeOneHTML trait added, giving access all HTML components.

- [BladeOneHTML](https://github.com/EFTEC/BladeOneHtml)
- [viewModel](docs/Bladeone-Template-Useage.md#view-model)
- [viewComponent](docs/Bladeone-Template-Useage.md#component)
- [nonce](docs/Bladeone-Template-Useage.md#nonce)

---

Magic Call Methods
------------------

[](#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.

```
// None static
$this->view->engine()->some_method($data);

// As static
BladeOne_Engine::some_method($data);
```

The can also be called in templates.

```
{$this->some_method($data)}

// Or
{BladeOne_Engine::some_method($data)}
```

> For the complete list of methods, please visit

Static Access
-------------

[](#static-access)

```
// Using the App's View method to access none static methods on the fly.
App::view()->engine()->some_method($data);
```

> calling `engine()` on view, will return the underlying rendering engine used, in this case `PinkCrab_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
---------

[](#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.

```
add_action( PinkCrab_BladeOne::SETUP_CONFIG, function( PinkCrab_BladeOne $engine ) {
    $engine->directive( 'my_directive', function( $expression ) {
        return "";
    } );
} );
```

Dependencies
------------

[](#dependencies)

- [BladeOne V4](https://github.com/EFTEC/BladeOne)
- [BladeOne HTML V2](https://github.com/eftec/BladeOneHtml)

Requires
--------

[](#requires)

- [PinkCrab Perique Framework V2 and above.](https://github.com/Pink-Crab/Perqiue-Framework)
- PHP7.4+

License
-------

[](#license)

### MIT License

[](#mit-license)

Previous Perique Support
------------------------

[](#previous-perique-support)

- For support of all versions before Perique V2, please use the [BladeOne\_Provider](https://github.com/Pink-Crab/Perique-BladeOne-Provider)

Change Log
----------

[](#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.

###  Health Score

32

—

LowBetter than 71% of packages

Maintenance44

Moderate activity, may be stable

Popularity14

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~114 days

Recently: every ~167 days

Total

7

Last Release

465d ago

Major Versions

1.1.0 → 2.1.02025-01-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/d82b9e8ef7816d3d0b9812ad233f61f6a313f529e0ac85721781b46ad292e1ea?d=identicon)[glynnquelch](/maintainers/glynnquelch)

---

Top Contributors

[![gin0115](https://avatars.githubusercontent.com/u/28779094?v=4)](https://github.com/gin0115 "gin0115 (109 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/pinkcrab-bladeone-engine/health.svg)

```
[![Health](https://phpackages.com/badges/pinkcrab-bladeone-engine/health.svg)](https://phpackages.com/packages/pinkcrab-bladeone-engine)
```

###  Alternatives

[mustache/mustache

A Mustache implementation in PHP.

3.3k44.6M290](/packages/mustache-mustache)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[whitecube/nova-flexible-content

Flexible Content &amp; Repeater Fields for Laravel Nova.

8053.0M25](/packages/whitecube-nova-flexible-content)[mopa/bootstrap-bundle

Easy integration of twitters bootstrap into symfony2

7042.9M33](/packages/mopa-bootstrap-bundle)[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3871.2M](/packages/limenius-react-bundle)[symfony/ux-icons

Renders local and remote SVG icons in your Twig templates.

545.8M69](/packages/symfony-ux-icons)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
