url icon indicating copy to clipboard operation
url copied to clipboard

Suggestion: add human readable toString method

Open 8ctopus opened this issue 4 months ago • 2 comments

When the url contains unicode, toString(), returns an url encoded string which is not human readable

$reference = Url::parse("https://test.com");
$url = $reference->resolve('/デジカ/');

echo $url->toString(); // https://test.com/%E3%83%87%E3%82%B8%E3%82%AB/

I suggest to add a new method toPrettyString() which simply returns the url decoded string.

    public function toPrettyString(): string
    {
        return urldecode($this->url);
    }
https://test.com/デジカ/

8ctopus avatar Aug 18 '25 07:08 8ctopus