PHP code example of stayforlong / twigstay
1. Go to this page and download the library: Download stayforlong/twigstay library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
stayforlong / twigstay example snippets
php artisan vendor:publish --provider="TwigBridge\ServiceProvider"
//app/Http/routes.php
//twig template resources/views/hello.twig
Route::get('/', function () {
return View::make('hello');
});
'TwigBridge\ServiceProvider',
'Twig' => 'TwigBridge\Facade\Twig',
Twig::addExtension('TwigBridge\Extension\Loader\Functions');
Twig::render('mytemplate', $data);
$app->configure('twigbridge');
$app->register('TwigBridge\ServiceProvider');
// Without the file extension
View::make('i_am_twig', [...])
View::make('pagination::simple')
'enabled' => array(
'TwigBridge\Extensions\Example'
)
'enabled' => [
function($app) {
$factory = new Assetic\Factory\AssetFactory($app['path'].'/../some/path/');
$factory->setDebug(false);
// etc.....
return new Assetic\Extension\Twig\AsseticExtension($factory);
}
]
bash
php artisan vendor:publish --provider="TwigBridge\ServiceProvider"
$ php artisan twig:clean
$ php artisan twig:lint