Created
July 23, 2013 18:33
-
-
Save failpunk/6064914 to your computer and use it in GitHub Desktop.
Silex References... https://speakerdeck.com/hhamon/designing-rest-api-with-silex
This file contains 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 | |
/* | |
* ROUTING | |
*/ | |
$app->get('/archive/{year}/{month}', function($month, $year) { | |
// ... | |
}) | |
->bind('archives') // Route name | |
->value('year', date('Y')) // Default parameter value | |
->value('month', date('m')) | |
->assert('year', '\d{4}') // Parameter format | |
->assert('month', '\d{2}'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment