I build an oEmbed provider in a Laravel application the other day and needed to parse an arbitrary URL to determine the route and parameters passed in order to determine the response.
Since I already had the routes built for the possible URLs, I didn’t want to duplicate code and re-parse them.
Here’s how I ended up retrieving the route and parameters: