Created
August 22, 2022 09:28
-
-
Save nyamsprod/a2197ba2537849b637947ccdae7449c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
use League\Uri\UriTemplate; | |
use League\Uri\Components\Query; | |
require 'vendor/autoload.php'; | |
$template = 'https://api.twitter.com/{version}/{?q*}'; | |
$params = ['q' => ['a', 'b']]; | |
$uriTemplate = new UriTemplate($template, ['version' => '1.1']); | |
$uri = $uriTemplate->expand($params); | |
$query = Query::createFromUri($uri); | |
var_dump((string) $uri, $query->getAll('q')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment