Created
March 6, 2013 14:31
-
-
Save davedevelopment/5099669 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class FooConverter | |
{ | |
public function convert($value) {} | |
} | |
$app = new Silex\Application; | |
$app['converters.foo'] = function($value) { | |
$converter = new FooConverter(); // or could pull from container if dependencies are required | |
return $converter->convert($value); | |
}; | |
$app->get("/foo/{foo}", function($foo) { | |
})->convert("foo", $app['converters.foo']); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment