Sometimes we want to parse the URL variables of a given route, ie getting the word user
from /api/users/{user}
. However there isn’t any helper method in Laravel that does this for us out of the box. The PHP built-in function parse_url
is not smart enough to understand the URL variables.
If we have:
parse_url('https://test.com/api/users/{user}?page=4&s…