PHP code example of ekandreas / bladerunner

1. Go to this page and download the library: Download ekandreas/bladerunner library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ekandreas / bladerunner example snippets



    bladerunner('views.pages.index')


    bladerunner('views.pages.404');


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


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



namespace App;

use Bladerunner\Controller;

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

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

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

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

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

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