2017 © Pedro Peláez
 

library slim-blade

Blade is a simple, yet powerful templating engine provided for the Slim Framework

image

clickcoder/slim-blade

Blade is a simple, yet powerful templating engine provided for the Slim Framework

  • Monday, July 21, 2014
  • by clickcoder
  • Repository
  • 3 Watchers
  • 35 Stars
  • 4,453 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 11 Forks
  • 6 Open issues
  • 1 Versions
  • 1 % Grown

The README.md

slim-blade

Blade is the default template engine of Laravel. The main advantage of Blade is template inheritance whilst using plain PHP. This package allows you to use Blade within the Slim Framework., (*1)

How to Install

using Composer

The package can be installed via Composer by requiring the "clickcoder/slim-blade": "dev-master" package in your project's composer.json., (*2)

{
    "require": {
        "clickcoder/slim-blade": "dev-master"
    }
}

Then run the following composer command:, (*3)

$ php composer.phar install

Blade

How to use

<?php
require 'vendor/autoload.php';

$app = new \Slim\Slim(array(
    'view' => new \Slim\Views\Blade(),
    'templates.path' => './templates',
));

To use Blade cache do the following:, (*4)

$view = $app->view();
$view->parserOptions = array(
    'debug' => true,
    'cache' => dirname(__FILE__) . '/cache'
);

You can use all blade features as described in the Laravel 4 documentation: http://laravel.com/docs/templates#blade-templating, (*5)

Example

Create the following index.php file, (*6)

<?php
require 'vendor/autoload.php';

$app = new \Slim\Slim(array(
    'view' => new \Slim\Views\Blade(),
    'templates.path' => './templates',
));

$view = $app->view();
$view->parserOptions = array(
    'debug' => true,
    'cache' => dirname(__FILE__) . '/cache'
);

$app->get('/hello/:name', function ($name) use ($app) {
    $app->render('master', array(
        'variable' =>  "Hello, $name"
    ));
});

$app->run();

Create a templates folder and add this inside, (*7)

<!DOCTYPE html>
<html lang="en">
    <body>
        {{ $variable }}
    </body>
</html>

visit /index.php/hello/world, (*8)

Authors

Kevin Darren, (*9)

License

MIT Public License, (*10)

The Versions

21/07 2014

dev-master

9999999-dev http://github.com/clickcoder/slim-blade

Blade is a simple, yet powerful templating engine provided for the Slim Framework

  Sources   Download

MIT

The Requires

 

by Avatar clickcoder

laravel blade slim slimphp slim-blade