2017 © Pedro Peláez
 

wordpress-plugin bladerunner

WordPress Blade L5 template engine

image

ekandreas/bladerunner

WordPress Blade L5 template engine

  • Wednesday, December 20, 2017
  • by EkAndreas
  • Repository
  • 7 Watchers
  • 76 Stars
  • 11,004 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 8 Forks
  • 6 Open issues
  • 75 Versions
  • 8 % Grown

The README.md

Bladerunner

License Build Status StyleCI GitHub release Twitter Follow, (*1)

WordPress plugin for Laravel Blade templating., (*2)

To install it to your Composer based WordPress installation:, (*3)

composer require ekandreas/bladerunner

Activate the plugin inside WordPress and templates with *.blade.php are inspected and active. Your theme still needs an index.php due to WordPress basic functionality. When removed the theme is known as broken., (*4)

If you don't use a composer based WordPress development environment you can download the latest distributed plugin at Bladerunner site http://bladerunner.aekab.se and install it the common way with zip upload to WordPress via wp-admin., (*5)

Releases to this plugin is listed last in this readme., (*6)

Hello World

  1. Install the library with composer
  2. Make sure the cache-folder is writeable in uploads, eg ../wp-content/uploads/.cache
  3. Activate the plugin
  4. Create a view, eg:
<!-- view file: views/pages/index.blade.php -->
Hello World Page rendered at {{ date('Y-m-d H:i:s') }}
  1. In your index.php, add a global call for the view created, eg:
<?php
    bladerunner('views.pages.index')

https://laravel.com/docs/5.2/blade, (*7)

Cache

  • If WP_DEBUG is set and true then templates always will be rendered and updated.
  • View files (cache) is invalidated at save_post
  • (It's a really good idea to empty the .cache folder inside uploads when develop templates. Eg, create a del command inside your gulp-file.)

Directories

  • Your cached views will always be stored in your wp upload folder, .cache
  • Your views must be placed within your theme folder.
  • Your views must have .blade.php extension.

Template helper

There is a template helper function named bladerunner, defined globally to use in standard WordPress templates., (*8)

Example: You want to create a 404-template and don't want to use the .blade.php extension to the template file., (*9)

  • Create a 404.php in the theme root.
  • Add the following code to the template:
<?php
    bladerunner('views.pages.404');
  • In the folder views/pages, create a blade template 404.blade.php

You can pass any data with the global bladerunner function like so,, (*10)

<?php
    bladerunner('views.pages.404', ['module'=>$module]);

or use compact, eg:, (*11)

<?php
    bladerunner('views.pages.404', compact('module'));

Controllers

With version 1.7 controllers are added to Bladerunner. As default Bladerunner will look for extended classes in the theme folder + /controllers. If you would like to add or change the controller paths take a look below at filters!, (*12)

The controller class has to extend \Bladerunner\Controller to work. It will guess the path to the view but you can override this with protected $view='your.custom.view.path'', (*13)

The controller files follow the same hierarchy as WordPress. You can view the controller hierarchy by using the Blade directive @debug., (*14)

Extend the Controller Class, it is recommended that the class name matches the filename. Create methods within the Controller Class: * Use public function to expose the returned values to the Blade views/s. * Use public static function to use the function within your Blade view/s. * Use protected function for internal controller methods as only public methods are exposed to the view. You can run them within __construct, (*15)

Controller example:

The following example will expose $images to views/single.blade.php, (*16)

controllers/Single.php, (*17)

<?php

namespace App;

use Bladerunner\Controller;

class Single extends Controller
{
    /**
     * Return images from Advanced Custom Fields
     *
     * @return array
     */
    public function images()
    {
        return get_field('images');
    }
}

views/single.blade.php, (*18)

@if($images)
  <ul>
    @foreach($images as $image)
      <li><img src="{{$image['sizes']['thumbnail']}}" alt="{{$image['alt']}}"></li>
    @endforeach
  </ul>
@endif

Hooks and Filters

Bladerunner continuously implements filters and hooks to modify values and processes., (*19)

Hooks

..., (*20)

Filters

Modify Bladerunners cache folder path, default ../wp-content/uploads/.cache, (*21)

add_filter('bladerunner/cache/path', function() {
    return '/my/path/to/cache';
});

If you don't want Bladerunner to create the cache folder:, (*22)

add_filter('bladerunner/cache/make', function() {
    return false;
});

If you wan't to customize the base paths where you have your views stored, use:, (*23)

add_filter('bladerunner/template/bladepath', function ($paths) {
    if (!is_array($paths)) {
        $paths = [$paths];
    }
    $paths[] = ABSPATH . '../../resources/views';
    return $paths;
});

If you wan't to customize the controller paths where you have your controllers stored, use:, (*24)

add_filter('bladerunner/controller/paths', function ($paths) { 
    $paths[] = PLUGIN_DIR . '/my-fancy-plugin/controllers';
    return $path; 
});

We will soon add more WordPress extenstions to the Bladerunner engine. Please give us your great examples to implement!, (*25)

Tests

Test requirements:

  • Latest Docker install (not the old school Boot2Docker)
  • PHP Composer Currently only tested on OSX.

Test step by step

Checkout the components for testing via Composer inside the repo:, (*26)

composer update

Using Testrunner (required-dev package) and Docker the test should be exexuted with a single command:, (*27)

vendor/bin/dep testrunner

The Versions

20/12 2017

dev-master

9999999-dev

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

17/10 2017

1.7.4

1.7.4.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

17/10 2017

1.7.3

1.7.3.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

31/08 2017

dev-analysis-XW1L9y

dev-analysis-XW1L9y

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

30/08 2017

dev-composer

dev-composer

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

30/08 2017

dev-develop

dev-develop

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

22/08 2017

1.7

1.7.0.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

22/08 2017

dev-release/1.7

dev-release/1.7

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

18/08 2017

1.7-beta.3

1.7.0.0-beta3

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

18/08 2017

dev-release/1.7-beta.3

dev-release/1.7-beta.3

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

18/08 2017

dev-release/1.7-beta.2

dev-release/1.7-beta.2

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

18/08 2017

1.7-beta.2

1.7.0.0-beta2

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

18/08 2017

dev-feature/1-7-beta-fix-2

dev-feature/1-7-beta-fix-2

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

18/08 2017

1.7-beta

1.7.0.0-beta

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

18/08 2017

1.7-beta.1

1.7.0.0-beta1

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

17/08 2017

1.6.3

1.6.3.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

24/04 2017

1.6.2

1.6.2.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

24/04 2017

dev-release/1.6.2

dev-release/1.6.2

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

14/02 2017

1.6.1

1.6.1.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

14/02 2017

dev-release/1.6.1

dev-release/1.6.1

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

24/01 2017

1.6

1.6.0.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

24/01 2017

dev-release/1.6

dev-release/1.6

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

24/01 2017

dev-feature/Rebuild

dev-feature/Rebuild

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

29/10 2016

1.5.2

1.5.2.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

13/10 2016

1.5.1

1.5.1.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

29/08 2016

1.5

1.5.0.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

10/05 2016

1.4.3

1.4.3.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

28/04 2016

1.4

1.4.0.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

07/04 2016

1.3.2

1.3.2.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

07/04 2016

1.3.1

1.3.1.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

15/02 2016

1.3

1.3.0.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

14/02 2016

1.2.1

1.2.1.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

03/02 2016

1.2

1.2.0.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

29/01 2016

1.1

1.1.0.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

28/01 2016

1.0.9

1.0.9.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

28/01 2016

1.0.8

1.0.8.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

22/01 2016

1.0.7

1.0.7.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

22/01 2016

1.0.6

1.0.6.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

22/01 2016

dev-analysis-zGDDyg

dev-analysis-zGDDyg

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

22/01 2016

1.0.5

1.0.5.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

19/01 2016

1.0.4

1.0.4.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

19/01 2016

1.0.3

1.0.3.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

15/01 2016

1.0.2

1.0.2.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

11/01 2016

1.0

1.0.0.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress laravel blade

08/01 2016

0.9

0.9.0.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

07/01 2016

0.8.8

0.8.8.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

06/01 2016

0.8.7

0.8.7.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

06/01 2016

0.8.6

0.8.6.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

06/01 2016

0.8.5

0.8.5.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

06/01 2016

0.8.4

0.8.4.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

06/01 2016

0.8.3

0.8.3.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

06/01 2016

0.8.2

0.8.2.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

06/01 2016

0.8.1

0.8.1.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

06/01 2016

0.8

0.8.0.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

06/01 2016

0.7.1

0.7.1.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

06/01 2016

0.7

0.7.0.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

06/01 2016

dev-frozzare-fixes/method-naming

dev-frozzare-fixes/method-naming

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

06/01 2016

dev-frozzare-fixes/docblock

dev-frozzare-fixes/docblock

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

05/01 2016

0.6.6

0.6.6.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

05/01 2016

0.6.5

0.6.5.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

05/01 2016

0.6.4

0.6.4.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

05/01 2016

0.6.3

0.6.3.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

05/01 2016

0.6.2

0.6.2.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

05/01 2016

0.6.1

0.6.1.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

05/01 2016

0.6

0.6.0.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

04/01 2016

0.5.7

0.5.7.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

04/01 2016

0.5.6

0.5.6.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

04/01 2016

0.5.5

0.5.5.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

22/12 2015

0.5.3

0.5.3.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

21/12 2015

0.5.2

0.5.2.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

21/12 2015

0.5.1

0.5.1.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

21/12 2015

0.5

0.5.0.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

17/12 2015

0.4.3

0.4.3.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

15/12 2015

0.4.2

0.4.2.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade

14/12 2015

0.4.1

0.4.1.0

WordPress Blade L5 template engine

  Sources   Download

MIT

The Requires

 

wordpress laravel blade