1. Go to this page and download the library: Download blat/slim-plates 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/ */
blat / slim-plates example snippets
use DI\Container;
use Slim\Factory\AppFactory;
use Slim\Views\Plates;
use Slim\Views\PlatesExtension;
s View in Container
$container->set('view', function () {
return new Plates(__DIR__ . '/../templates');
});
// Create App
$app = AppFactory::create();
// Add Plates Extension Middleware
$app->add(new PlatesExtension($app));
// Define named route
$app->get('/hello/{name}', function ($request, $response, $args) {
return $this->get('view')->render($response, 'profile', [
'name' => $args['name']
]);
})->setName('profile');
// Run app
$app->run();
$this->layout('template')
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.