peterhorne / elmer

A simple and flexible framework for PHP
4 stars 1 forks source link

Using regexes in parts of URIs #12

Closed peterhorne closed 12 years ago

peterhorne commented 12 years ago

Support for the following would be great:

<?php
$app->get('/data/(:id).json', function() { .. });

Alternatively, adding support for file extensions so the user can write:

<?php
$app->get('/data/:id.json', function() { .. });

Second option looks like the best one at the moment? Also, we could then expose the file extension in the request object?

peterhorne commented 12 years ago

Fixed in af1441c. Variable parts can be used anywhere in a string as behind the scenes it is just a simple str_replace now.