PHP code example of rych / silex-plates-provider

1. Go to this page and download the library: Download rych/silex-plates-provider 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/ */

    

rych / silex-plates-provider example snippets




/* @var $app Silex\Application */
$app->register(new \Rych\Silex\Provider\PlatesServiceProvider(), array (
    'plates.path' => '/path/to/templates', // Required
    'plates.folders' => array (            // Optional
        'email' => '/path/to/email/templates';
    ),
));

$app->get('/', function () use ($app) {
    return $app['plates']->render('mytemplate');
});




/* @var $app Silex\Application */
$app['plates.engine'] = $app->share($app->extend('plates.engine', function($engine, $app) {
    $engine->addExtension(new \My_Plates_Extension());

    return $engine;
}));