Search code examples
symfony6

Class "League\Uri\Modifier" is missing from package?


On my Symfony6 project I wish to use this package: https://packagist.org/packages/league/uri

The documentation suggests this usage, that would fit my use-case:

$newUri = Modifier::from($uri)->appendQuery('q=new.Value');
echo $newUri; // 'http://example.com?q=value&q=new.Value#fragment'

Yet the Modifier class is absent from the package. It was added via: composer require league/uri and is at version 7.3.0. I guess the doc is not up to date, but how do I modify URIs with the lastest version?


Solution

  • The component is divided into different repositories. To use Modifiers, One needs to install:
    composer require league/uri-components

    Also, there is more doc here:
    https://uri.thephpleague.com/components/7.0/modifiers/