figdice / slim-view
Slim Framework 3 view helper built on top of the FigDice templating component
Installs: 160
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/figdice/slim-view
Requires
- php: >=5.3.0
- figdice/figdice: ^2.2
- psr/http-message: ^1.0
This package is not auto-updated.
Last update: 2025-10-11 23:48:47 UTC
README
Slim Framework 3 Delegate for FigDice View
Container (DI) View component for the Slim Framework 3, that wires FigDice Templating library into Slim.
Read Slim Views Documentation for more details.
Installation
In composer.json:
"require": { "figdice/slim-view": "*" }
Usage
1. Register FigDice SlimView component in Slim container
// Create container $container = new \Slim\Container; // Register component on container $container['view'] = function ($c) { $slimview = new \figdice\slim\SlimView('path/to/templates'); // Optionally configure FigDice View settings // (cache directory, dictionaries, feed & function factories, etc.) $slimview->getView()->setTempPath('path/to/cache'); $slimview->getView()->registerFeedFactory( new MyFeedFactory(...) ); // ... return $slimview; };
2. Render FigDice templates in Slim routes
// Create app $app = new \Slim\App($container); // Render FigDice template in route $app->get('/hello/{name}', function ($request, $response, $args) { return $this->view->render($response, 'profile.html', [ 'name' => $args['name'] ]); }); // Run app $app->run();