Skip to content

Commit 59ba2cc

Browse files
authored
Merge pull request #5 from daison12006013/master
Updating ReadMe and Enhancement Applied
2 parents 64e40c9 + f66df5e commit 59ba2cc

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,21 @@ $blade = new Blade('views', 'cache');
3131
echo $blade->make('homepage', ['name' => 'John Doe']);
3232
```
3333

34-
The Blade instances passes all methods to the internal view factory. So methods such as `exists`, `file`, `share`, `composer` and `creator` are available as well. Check out the [original documentation](http://laravel.com/docs/5.1/views) for more information.
34+
Now you can easily create a directive by calling the ``compiler()`` function
35+
36+
```php
37+
$blade->compiler()->directive('datetime', function ($expression) {
38+
return "<?php echo with({$expression})->format('F d, Y g:i a'); ?>";
39+
});
40+
41+
{{-- In your Blade Template --}}
42+
<?php $dateObj = new DateTime('2017-01-01 23:59:59') ?>
43+
@datetime($dateObj)
44+
```
45+
46+
The Blade instances passes all methods to the internal view factory. So methods such as `exists`, `file`, `share`, `composer` and `creator` are available as well. Check out the [original documentation](http://laravel.com/docs/5.2/views) for more information.
47+
48+
Integrations
49+
-----
50+
51+
- [Phalcon Slayer Framework](https://github.com/phalconslayer/slayer) comes out of the box with Blade.

src/Blade.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
<?php namespace Jenssegers\Blade;
1+
<?php
2+
namespace Jenssegers\Blade;
23

34
use Illuminate\Container\Container;
45
use Illuminate\Contracts\Container\Container as ContainerInterface;
56
use Illuminate\Events\Dispatcher;
67
use Illuminate\Filesystem\Filesystem;
78
use Illuminate\View\ViewServiceProvider;
89

9-
class Blade {
10+
class Blade
11+
{
1012

1113
/**
1214
* Container instance.
@@ -69,6 +71,7 @@ protected function setupContainer()
6971
* @param string $view
7072
* @param array $data
7173
* @param array $mergeData
74+
*
7275
* @return string
7376
*/
7477
public function render($view, $data = [], $mergeData = [])

0 commit comments

Comments
 (0)