marcj / php-rest-service

Php-Rest-Service is a very simple and fast PHP class for server-side RESTful JSON APIs.
MIT License
216 stars 74 forks source link

Optional parameters in the url? #31

Open nikksan opened 7 years ago

nikksan commented 7 years ago

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?

marcj commented 5 years ago

you should change it to products/([^/]*)/([^/]*), since .* matches also /.