php-rest-service
php-rest-service copied to clipboard
Optional parameters in the url?
Is there any way I can declare optional parameters in the url ?
-> (..) addGetRoute('products/(.*)/(.*)', function(){ $product = new Product(get_registry()); $product->getProducts(); }) (..)
For this url I have to supply 2 arguments. How can I make it work without them?
you should change it to products/([^/]*)/([^/]*), since .* matches also /.