harikt/blade-renderer

Laravel blade renderer for Zend expressive

0.4.1 2018-03-15 17:33 UTC

This package is auto-updated.

Last update: 2024-12-07 21:06:46 UTC


README

Build Status

composer require harikt/blade-renderer

In your config/autoload/templates.global.php use something as below.

<?php

use Zend\Expressive\Template\TemplateRendererInterface;
use Harikt\Blade\BladeRendererFactory;

return [
    'dependencies' => [
        'factories' => [
            TemplateRendererInterface::class => BladeRendererFactory::class,
        ],
    ],

    'templates' => [
        'paths' => [
            'app' => __DIR__ . '/views/app',
        ]
    ]

    'blade' => [
        'cache_dir'      => '/cache/path',
    ],
];

Helper functions

You can make use of zend expressive provided url helper functions with the shared variable $urlHelper and $serverUrlHelper.

Example usage.

Hello {{ $name }}

{{ $urlHelper('article_show', ['id' => '3'], ['foo' => 'bar'], 'fragment') }}

{{ $serverUrlHelper('/hello/world') }}