Skip to content

Instantly share code, notes, and snippets.

@SocalNick
Created June 27, 2012 18:23
Show Gist options
  • Save SocalNick/3005860 to your computer and use it in GitHub Desktop.
Save SocalNick/3005860 to your computer and use it in GitHub Desktop.
ZF2 FilterChain Sample Configuration
<?php
// Convert "socalnick.dev.phantom.www.ign.com" or "www.ign.com" to "WwwIgnCom"
$filter = new Zend\Filter\FilterChain(array(
'filters' => array(
array(
'name' => 'pregReplace',
'options' => array(
'match' => '/^(.*phantom\.)?([^:]+)(:\d+)?$/i',
'replace' => '$2',
),
),
array(
'name' => 'word\SeparatorToCamelCase',
'options' => array('.'),
),
),
));
$siteModule = $filter->filter($_SERVER['SERVER_NAME']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment