windwalker/uri
A PHP URI library for parsing, building, and manipulating URLs and URIs. Create immutable URI objects, resolve relative references, handle query strings and fragments, and normalize paths with a clean, standards-aware API.
UriInterface implementation that gives you RFC 3986-style parsing and immutable mutation (withScheme, withQuery, withPath) without pulling in a full HTTP message stack.Uri means URL construction lives in a domain service rather than being entangled with request/response objects. That's a real maintainability argument for a roadmap item like "extract link generation into a shared service."?a=1&b=2 and ?b=2&a=1 collapse), rewriting pagination and filter links, generating signed URLs where the canonical string must be deterministic, and producing absolute URLs from route fragments in API responses.[READ ONLY] marker in the description are strong signals of an unmaintained or archived fork. Choosing it is a decision to own an unowned dependency. That belongs in a build-vs-buy note in the epic, not buried in a composer.json diff.Adopt only under a narrow set of conditions, all of which must hold:
UriInterface and nothing more. No streams, no headers, no request/response objects. If you're already installing guzzlehttp/psr7 or nyholm/psr7 for their message factories, use their Uri and skip this entirely — a second PSR-7 implementation in the same process is a genuine source of instanceof and type-coercion bugs./, percent-encoding normalization, relative resolution) bites you.Look elsewhere when: you need RFC 3986 resolution against a base URI, IDN/IRI support, or template expansion — league/uri is the mature answer and has the test suite to prove it. Look elsewhere when the dependency will be load-bearing in a security-sensitive path (URL validation for SSRF defense, redirect allowlisting); a zero-adoption parser is the wrong place to discover an encoding bug. And look elsewhere as a default: the honest recommendation for most Laravel teams is league/uri for URL semantics, guzzlehttp/psr7 if you're already in PSR-7, and Laravel's own UrlGenerator for route-based URL building.
To executives: We evaluated a small MIT-licensed library for URL parsing and manipulation — the kind of plumbing behind link generation, canonical URLs, and webhook addressing. Technically it does the job. Commercially the risk is one-sided: zero public adoption, zero downstream dependents, and a repository marked read-only, meaning no upstream maintenance. The cost isn't the license, it's the eventual ownership. Recommendation: do not adopt as a dependency. If we need this, we use a maintained equivalent — same capability, no orphaned code — and we treat URL normalization as a correctness requirement in the relevant epics rather than a library choice.
To engineering: The UriInterface contract is the right abstraction and worth keeping in our designs — it forces URL construction out of controllers and into testable services. But this implementation buys us that abstraction at the price of a dependency nobody maintains. Use a maintained PSR-7 implementation if we're already in that world, league/uri for anything involving parsing edge cases or base-URI resolution, and Laravel's UrlGenerator where routes are the source of truth. If someone wants this specific package, the bar is a written justification covering: what edge cases we've tested, who owns the fork, and what triggers removal.
How can I help you explore Laravel packages today?