vdb/uri
A Laravel/PHP package for building, parsing, and manipulating URIs with a fluent, immutable API. Compose paths and query strings, validate URL components, and work with clean URI value objects in your applications.
HTTP://Example.com:80/a/../b?) to one form. A strict RFC 3986 parser with normalization semantics is the difference between "two links" and "one link" in your reporting.parse_url() / Laravel's UrlGenerator + string helpers, (b) this package, (c) league/uri, (d) a hand-rolled parser. This assessment is the artifact that closes that decision and names the fallback.next/prev/self links by resolving relative references against a base URI is exactly RFC 3986 §5 reference resolution; this is a small but genuine API-surface decision.explode('/').Consider it when:
parse_url() and most framework helpers do not give you.java.net.URI — relevant if you have JVM-experienced engineers or are porting logic from a Java service.Look elsewhere when:
league/uri fits. It is the mature PHP option: broader RFC coverage, IDN/IRI handling, PSR-7/PSR-17 interop, active maintenance, and a real user base. Default to it unless you have a specific reason not to.guzzlehttp/psr7 or your HTTP client's URI class is already in the tree.UrlGenerator and Route already do this; adding a parser is over-engineering.To executives: This is a small, MIT-licensed, zero-cost library for parsing and rebuilding URLs correctly. The business value is narrow but real: cleaner canonical URLs, safer redirect allowlists, and fewer "the link didn't work" defects. The risk is that it is an 11-star package with a single maintainer and no downstream users — so the recommendation is not to adopt it as infrastructure. The recommendation is to spend a short spike evaluating it behind our own internal Uri interface, so the decision is reversible in an afternoon and we end up with either a validated dependency or a one-line swap to the established alternative. Cost: days, not weeks. Downside if we skip it: we keep paying for URL edge cases in bugs and dirty analytics data.
To engineering: It gives you an RFC 3986 parser plus immutable URI value objects with resolution and normalization — the parts parse_url() gets wrong and Laravel's helpers don't attempt. It will not do IDN, it will not do DNS or IP classification, and it is not a security control. Treat it as a syntax layer. Two conditions on adoption: (1) wrap it behind our own small interface so the vendor is swappable to league/uri without touching call sites, and (2) land a contract test suite covering our real-world URL corpus — percent-encoding, empty query vs. no query, default ports, .. segments, trailing slashes — before it goes near a user-facing path. Given 0 dependents and a low opportunity score, assume the edge cases are ours to find; budget for that or choose league/uri and skip the exercise.
How can I help you explore Laravel packages today?