Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/clickcoder/slim-blade
Blade is a simple, yet powerful templating engine provided for the Slim Framework
https://github.com/clickcoder/slim-blade
Last synced: 11 days ago
JSON representation
Blade is a simple, yet powerful templating engine provided for the Slim Framework
- Host: GitHub
- URL: https://github.com/clickcoder/slim-blade
- Owner: clickcoder
- Created: 2014-07-21T09:28:20.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-07-22T19:37:11.000Z (over 10 years ago)
- Last Synced: 2024-08-02T06:25:10.153Z (3 months ago)
- Language: PHP
- Size: 210 KB
- Stars: 32
- Watchers: 3
- Forks: 10
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
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.
## How to Install
#### using [Composer](http://getcomposer.org/)
The package can be installed via Composer by requiring the "clickcoder/slim-blade": "dev-master" package in your project's composer.json.
```json
{
"require": {
"clickcoder/slim-blade": "dev-master"
}
}
```Then run the following composer command:
```bash
$ php composer.phar install
```## Blade
### How to use
```php
new \Slim\Views\Blade(),
'templates.path' => './templates',
));
```To use Blade cache do the following:
```php
$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
### Example
Create the following index.php file
```php
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
```php
{{ $variable }}
```
visit /index.php/hello/world
## Authors
[Kevin Darren](https://github.com/clickcoder)
## License
MIT Public License