From 9704f87e7fc3cd9a4e24ad830fbf35de9261361a Mon Sep 17 00:00:00 2001 From: Matthew Laver Date: Fri, 22 May 2015 12:37:07 +0100 Subject: [PATCH] Update README.md Add information about how to get the form and html extensions to work. It just took me two hours to get it working, so it may help someone else. --- README.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/README.md b/README.md index 166da857..124086eb 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,58 @@ Twig::render('mytemplate', $data); TwigBridge's configuration file can be extended in your ConfigServiceProvider, under the `twigbridge` key. You can find the default configuration file at `vendor/rcrowe/twigbridge/config`. +For example +```php +config([ + 'twigbridge' => [ + 'twig' => [ + 'extension' => 'twig', + 'environment' => [ + 'debug' => config('app.debug', false), + 'charset' => 'utf-8', + 'base_template_class' => 'TwigBridge\Twig\Template', + 'cache' => null, + 'auto_reload' => true, + 'strict_variables' => false, + 'autoescape' => true, + 'optimizations' => -1, + ], + 'globals' => [], + ], + + 'extensions' => [ + 'enabled' => [ + 'TwigBridge\Extension\Loader\Facades', + 'TwigBridge\Extension\Loader\Filters', + 'TwigBridge\Extension\Loader\Functions', + + 'TwigBridge\Extension\Laravel\Auth', + 'TwigBridge\Extension\Laravel\Config', + 'TwigBridge\Extension\Laravel\Dump', + 'TwigBridge\Extension\Laravel\Input', + 'TwigBridge\Extension\Laravel\Session', + 'TwigBridge\Extension\Laravel\String', + 'TwigBridge\Extension\Laravel\Translator', + 'TwigBridge\Extension\Laravel\Url', + + 'TwigBridge\Extension\Laravel\Form', + 'TwigBridge\Extension\Laravel\Html', + // 'TwigBridge\Extension\Laravel\Legacy\Facades', + ], + 'facades' => [], + 'functions' => [ + 'elixir', + 'head', + 'last', + ], + 'filters' => [], + ], + ] +]); +``` + +In order to use the included Form and Html extensions you will need install the Laravel Collective Html package. Remembering to add 'Collective\Html\HtmlServiceProvider' to your config/app.php file. + # Installation on Lumen For Lumen, you need to load the same Service Provider, but you have to disable the `Auth`, `Translator` and `Url` extensions in your local configuration.