2017 © Pedro Peláez
 

library staticpageprovider

image

monkeycode/staticpageprovider

  • Thursday, February 20, 2014
  • by meandmymonkey
  • Repository
  • 1 Watchers
  • 1 Stars
  • 121 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

StaticPageControllerProvider for Silex

A Silex ControllerProvider that helps reducing boilerplate code for static page configuration when building small sites with Silex and Twig., (*1)

Build Status, (*2)

Usage

``` php $controllers = new StaticPageControllerProvider( [ 'home' => ['path' => '/', 'template' => 'index.html.twig'], 'about' => ['path' => '/about', 'template' => 'team.html.twig'], 'services' => ['path' => '/services', 'template' => 'services.html.twig'], 'contact' => ['path' => '/getintouch', 'template' => 'contact.html.twig'] ] );, (*3)


Cache Headers ------------- The options accepted by Symfony's ```Response::setCache()``` method can be configured as a second argument, and will be used for all registered pages: ``` php $controllers = new StaticPageControllerProvider( [ 'home' => ['path' => '/', 'template' => 'index.html.twig'] ], ['s_maxage' => 3600] );

Content Type

An optional type parameter can be used to set the response content type:, (*4)

php $controllers = new StaticPageControllerProvider([ 'descr' => [ 'path' => '/descr', 'template' => 'descr.xml.twig', 'type' => 'text/xml', ] ]);, (*5)

The Versions