I'm new to php and I'm using Slim Framework to develop a simple Rest Api.
According to docs, Slim uses FastRoute.
I have a route with optional params (vendor and quantity) like that:
If you are going to have optional parameters, which are of the same types and can be sent in any order, you could either use query strings, or have a fixed format where you add something like 0 instead of omitting it. Example where "vendor" isn't set:
Then the parameters aren't optional in the URL/route but you can handle that in your controller instead, just ignoring them if the param is a zero.