You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding the ability to extract variables from an URI using a UriTemplate object.
Proposed public API
useLeague\Uri\UriTemplate;
useLeague\Uri\UriTemplate\VariableBag;
$template = 'https://example.com/hotels/{hotel}/bookings/{booking}';
$uriString = 'https://example.com/hotels/Rest%20%26%20Relax/bookings/42';
$uriTemplate = newUriTemplate($template);
$variables = $uriTemplate->extract($uriString);
// the extract method SHOULD accept as input// - URI implementing objects (league and PSR-7) // - stringable objects// - string// the extract method MUST return a VariableBag object$variables->isEmpty(); // return falsecount($variables); // returns 2echo$variables['booking']; // returns '42'echo$variables['hotel]; // returns 'Rest & Relax'
Good to know
The VariableBag object already exists
The internal representation of the UriTemplate broke down into expression and var specifier exists
Todo (implementation)
Create from an League\Uri\UriTemplate\Template object the correct regular expression for each expression and var specifier and process the URI input to get all existing variables.
The text was updated successfully, but these errors were encountered:
Feature Request
Proposal
Adding the ability to extract variables from an URI using a
UriTemplate
object.Proposed public API
Good to know
VariableBag
object already existsTodo (implementation)
Create from an
League\Uri\UriTemplate\Template
object the correct regular expression for each expression and var specifier and process the URI input to get all existing variables.The text was updated successfully, but these errors were encountered: