Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Uri Builder Laravel Package

juststeveking/uri-builder

juststeveking/uri-builder is a lightweight, fluent URI builder for PHP and Laravel. It lets you construct and manipulate URLs through a clean, chainable API for schemes, hosts, paths, query parameters, and fragments, avoiding fragile manual string concatenation. Ideal for consistent link generation.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Feature delivery: every outbound-URL surface. Referral/UTM links, webhook callback URLs, password-reset and invitation links, deep links into a mobile app, pagination and canonical/sitemap entries, and signed URLs all share a URI-assembly step. This package is a candidate to standardize that step instead of hand-rolled sprintf('%s://%s/%s') string building scattered across controllers, jobs, and mailables.
  • Build vs. buy (vs. vendor). There is no differentiation in writing your own concatenation helper; the real decision is which abstraction you standardize on — a lightweight fluent builder, a PSR-7/PSR-17 implementation, or a full URI library like league/uri. This package sits at the "smallest thing that removes a bug class" end of that spectrum, which is the right end for a product that just needs correct links.
  • Architecture direction toward framework-agnostic domain code. With no Laravel coupling, it supports keeping link-generation logic in a testable service layer rather than smeared into HTTP-facing code — useful if you ever extract a service, run queue workers, or support multiple front-ends.
  • Multi-tenant / white-label and environment routing. Tenant-specific hosts, ports, and base paths map naturally onto a component-by-component builder, which directly supports roadmap work on configurable branding and environment-aware link generation.
  • Encoding-correctness as a quality initiative. Broken links, failed callbacks, and rejected signed URLs are a recurring, code-review-invisible defect class (spaces, non-ASCII, reserved characters, double-encoding). Centralizing URI construction is the cheapest lever a PM has on it.
  • Dependency-governance as an explicit decision. With 20 stars, 0 dependents, and a last release in mid-2022, adopting this is a decision to accept a single-maintainer, low-validation utility. That is a legitimate call — but it should be made deliberately and cheaply, which this package forces you to do.

When to Consider This Package

Consider it when:

  • You are assembling URIs in application code you control and want a readable, chainable, immutable API rather than interpolation.
  • You want immutable value objects so a URL can be passed between services without defensive copying or accidental mutation.
  • You do not need PSR-7/PSR-17 interoperability — no HTTP client/middleware pipeline expecting UriInterface.
  • Dependency footprint matters (queue workers, tight container images, constrained hosting) and pulling a full PSR-7 stack just to build a URL is disproportionate.
  • You are prepared to wrap it behind an internal facade, which makes the small surface area and stale release cadence acceptable.

Look elsewhere when:

  • You need PSR-7 compliance or interop with Guzzle/Symfony — use guzzlehttp/psr7, nyholm/psr7, or Laravel's native Illuminate\Support\Uri.
  • You need to parse, inspect, or mutate arbitrary incoming URLs, resolve relative references, handle IDN hosts, or manage repeated query keys — league/uri is the right tool.
  • You require active maintenance, security patching, or an SLA. Last release July 2022, zero dependents, single maintainer: do not place this on a critical authentication, payment, or signed-URL path without an exit plan.
  • Your dependency-approval policy requires maintainer diversity or release recency — it will not pass, and it probably is not worth an exception.
  • The "slightly opinionated" behavior conflicts with existing conventions (trailing slashes, default ports, empty-path handling). Verify against your own edge cases before standardizing.

How to Pitch It (Stakeholders)

To executives: This is a tiny MIT-licensed utility, not a platform bet. Its value is eliminating a class of "broken link" production bugs at near-zero cost — no fees, no vendor lock-in, no architectural commitment. The risk is equally bounded: the whole library is a thin, readable wrapper we could reimplement in an afternoon if it were ever abandoned, so exposure is measured in hours, not quarters. Recommendation: approve a short pilot on one non-revenue-critical surface behind our own interface; do not adopt it as a strategic dependency or on any payment or auth path.

To engineering: Fluent, immutable, framework-agnostic, no PSR-7 baggage — it makes URI construction explicit and testable instead of ad hoc. Integration is a single composer require with no service provider or config, so the real work is behavioral verification, not plumbing. Before adopting we confirm three things: its Composer PHP constraint against our supported matrix; output parity with our existing URL tests on spaces, unicode, &, #, =, and already-encoded input; and behavior under hostile values containing &, ?, #, or CRLF. Wrap it in a one-file EndpointBuilder adapter so switching to league/uri, a PSR-7 implementation, native Illuminate\Support\Uri, or a fork is a contained change. Use it for outbound URL assembly only — leave route()/url() and route-name, locale, and signed-URL integration alone, and do not adopt it for security-sensitive link generation without an exit plan. Adopt on a pinned version and record the decision and edge-case behavior in an ADR plus characterization tests so a future swap is deliberate and test-visible.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package