Closed yinbug closed 2 years ago
@yinbug What would this feature do that is not yet covered by
The array of the official example is a key value pair. I want to leave out the key names and fill them in order. This is just an idea of mine.
<?php
use League\Uri\UriTemplate;
$template = 'https://example.com/hotels/{hotel}/bookings/{booking}';
$params = ['booking' => '42', 'hotel' => 'Rest & Relax'];
$uriTemplate = new UriTemplate($template);
$uri = $uriTemplate->expand($params);
<?php
use League\Uri\UriTemplate;
$template = 'https://example.com/hotels/{hotel}/bookings/{booking}';
$params = [ '42', 'Rest & Relax'];
$uriTemplate = new UriTemplate($template);
$uri = $uriTemplate->expand($params);
Still I fail to see the added value. Why can't you just fill in the names of the arguments ?
Feature Request
Proposal
Want to add the function of filling replacement templates in order. It is better to support
array
for example
sprintf( 'http://xx.com/{id}/look/{pid}', $id, $pid);