Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

fogley's avatar

I guess The PHP League makes great packages, but...

How is this intuitive?

use League\Uri\Uri;
use League\Uri\UriModifier;

$uri = Uri::createFromString('http://example.com?q=value#fragment');
$newUri = UriModifier::appendQuery($uri, 'q=new.Value');
echo $newUri; // 'http://example.com?q=value&q=new.Value#fragment';

Why isn't the above written like this?

use League\Uri\Uri;

$uri = new Uri('https://some.uri/?with=a&query=here);
$uri->addQuery('query_name', 'query_value');

I've used a lot of their packages but at this point I'm frankly frustrated I need to refer to their docs every time I need to make tweaks to my URL parsing. Today this thing finally broke me; I give it URL encoded data for my query string and it apparently can't leave it alone, decoding it before spitting out the final URL. I do not want that.

Can someone shed some light on why this package is considered any good and/or intuitive and whether or not I'm missing something really basic.

Are there any reasonable alternatives?

I am sorry if I seem angry and unreasonable, but this package has been a constant nuisance to work with and I guess this post has been my outlet to some extent. I fully accept the possibility that I am flat out wrong here.

Ugh, I need a cup of coffee.

0 likes
0 replies

Please or to participate in this conversation.