PHP code example of afbora / kirby-blade

1. Go to this page and download the library: Download afbora/kirby-blade 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/ */

    

afbora / kirby-blade example snippets


// override Kirby `e()` helper for Blade plugin
define('KIRBY_HELPER_E', false);

'afbora.blade.templates' => '/theme/default/templates',

'afbora.blade.views' => '/site/storage/views',

@asset($path)
@csrf()
@css($path)
@dump($variable)
@e($condition, $value, $alternative)
@get($key, $default)
@gist($url)
@go($url, $code)
@h($string, $keepTags)
@html($string, $keepTags)
@js($path)
@image($path, $attr) // @image('forrest.jpg', 'url')
@kirbytag($type, $value, $attr)
@kirbytags($text, $data)
@kirbytext($text, $data)
@kirbytextinline($text)
@kt($text)
@markdown($text)
@option($key, $default)
@page($key, $attr) // @page('blog', 'title')
@param($key, $fallback)
@site($attr) // @site(title')
@size($value)
@smartypants($text)
@snippet($name, $data)
@svg($file)
@t($key, $fallback)
@tc($key, $count)
@tt($key, $fallback, $replace, $locale)
@u($path, $options)
@url($path, $options)
@video($url, $options, $attr)
@vimeo($url, $options, $attr)
@widont($string)
@youtube($url, $options, $attr)

'afbora.blade.directives' => [
    'greeting' => function ($text)
    {
        return " echo 'Hello: ' . $text 

'afbora.blade.ifs' => [
    'logged' => function ()
    {
        return !!kirby()->user();
    },
],

@logged
    Welcome back {{ $kirby->user()->name() }}
@else
    Please Log In
@endlogged

'afbora.blade.minify.enabled' => true,
'afbora.blade.minify.options' => [
    'doOptimizeViaHtmlDomParser' => true, // set true/false or remove line to default
    'doRemoveSpacesBetweenTags'  => false // set true/false or remove line to default
],