jibundeyare / silex-php-view
A minimal php view service provider for silex framework
Installs: 136
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/jibundeyare/silex-php-view
Requires
- jibundeyare/raw-php-view: ~1.0
Requires (Dev)
- silex/silex: ~2.0
This package is not auto-updated.
Last update: 2025-10-02 18:25:14 UTC
README
A minimal php view service for silex framework
install
Open a terminal, go to your project directory and type:
composer require jibundeyare/silex-php-view
parameters
view.path : Path to the directory containing php template files.
views directory
It is recommended to create a separate directory to store the views.
In the examples, we use the following directory structure:
project/
public/
index.php
templates/
hello.php
vendor/
registering
// public/index.php
$app->register(new SilexPhpView\ViewServiceProvider(), [
'view.path' => __DIR__.'/../templates',
]);
usage
// public/index.php
$app->get('/test', function() use($app) {
$greeting = 'Hello!';
return $app['view']->render('hello.php', [
'greeting' => $greeting,
]);
});
// templates/hello.php
echo $greeting;