Skip to content

Commit

Permalink
Merge pull request #5 from daison12006013/master
Browse files Browse the repository at this point in the history
Updating ReadMe and Enhancement Applied
  • Loading branch information
jenssegers authored Aug 23, 2016
2 parents 64e40c9 + f66df5e commit 59ba2cc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,21 @@ $blade = new Blade('views', 'cache');
echo $blade->make('homepage', ['name' => 'John Doe']);
```

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.
Now you can easily create a directive by calling the ``compiler()`` function

```php
$blade->compiler()->directive('datetime', function ($expression) {
return "<?php echo with({$expression})->format('F d, Y g:i a'); ?>";
});

{{-- In your Blade Template --}}
<?php $dateObj = new DateTime('2017-01-01 23:59:59') ?>
@datetime($dateObj)
```

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.

Integrations
-----

- [Phalcon Slayer Framework](https://github.com/phalconslayer/slayer) comes out of the box with Blade.
7 changes: 5 additions & 2 deletions src/Blade.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?php namespace Jenssegers\Blade;
<?php
namespace Jenssegers\Blade;

use Illuminate\Container\Container;
use Illuminate\Contracts\Container\Container as ContainerInterface;
use Illuminate\Events\Dispatcher;
use Illuminate\Filesystem\Filesystem;
use Illuminate\View\ViewServiceProvider;

class Blade {
class Blade
{

/**
* Container instance.
Expand Down Expand Up @@ -69,6 +71,7 @@ protected function setupContainer()
* @param string $view
* @param array $data
* @param array $mergeData
*
* @return string
*/
public function render($view, $data = [], $mergeData = [])
Expand Down

0 comments on commit 59ba2cc

Please sign in to comment.