Weave Code
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 Components Laravel Package

league/uri-components

Immutable value objects for concrete URI components (host, path, query, etc.) in the League URI ecosystem. Requires PHP 8.1+. Supports IDN hosts with intl (or polyfill) and IPv4 conversion via GMP/BCMath or 64-bit PHP.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Standardization of URI Handling: Enables consistent URI manipulation across microservices, APIs, and frontend-backend interactions in a PHP-based stack.
  • API Design & Query Parameter Management: Simplifies complex query string operations (e.g., filtering, sorting, pagination) by providing immutable, type-safe components (e.g., Query::withList, Query::filter).
  • URL Shortening/Redirection Services: Supports URI normalization (e.g., Modifier::normalizeHost, Modifier::normalizeIp) for canonicalization and deduplication.
  • Security Features: Facilitates URI sanitization (e.g., Modifier::redactUserInfo, Modifier::redactPathSegments) to prevent exposure of sensitive data in logs or URLs.
  • Build vs. Buy: Avoids reinventing URI parsing/validation logic, reducing technical debt while maintaining flexibility for custom use cases (e.g., domain/subdomain checks via Domain::isSubdomainOf).
  • Internationalization (i18n): Handles IDN (Internationalized Domain Names) via intl extension or polyfills, critical for global applications.
  • Data Migration Tools: Enables safe URI transformation during schema changes (e.g., Modifier::replaceQueryPair, Modifier::prependPath).
  • Analytics/Tracking: Supports URI component extraction (e.g., Query::indexOfValue, Path::contains) for clickstream or A/B testing data pipelines.

When to Consider This Package

  • Adopt When:

    • Your PHP application requires immutable, type-safe URI components (e.g., for APIs, CLI tools, or libraries).
    • You need advanced query string manipulation (e.g., filtering, sorting, or complex parameter handling) beyond basic parse_str/http_build_query.
    • Your system involves domain/subdomain logic (e.g., multi-tenant apps, CDN routing, or URL rewriting).
    • You require WHATWG/URL or RFC 3986 compliance for cross-browser or standards-compliant URI handling.
    • Security is a priority (e.g., redacting PII from URLs, validating IDNs, or normalizing hosts/IPs).
    • You’re using Laravel or other PHP frameworks and want to avoid PSR-7 bloat for simple URI tasks.
  • Look Elsewhere If:

    • You need full URI parsing/validation (use league/uri or symfony/psr-http-message instead).
    • Your project is JavaScript/TypeScript-heavy (consider native URL API or url-pattern).
    • You require low-level byte manipulation (e.g., for custom URI schemes; use ext/standard functions).
    • You’re constrained by PHP < 8.1 (this package drops legacy support).
    • Your use case is trivial (e.g., simple string concatenation; use native PHP functions).

How to Pitch It (Stakeholders)

For Executives: "This package lets us treat URLs as structured data—like JSON for web addresses—so we can safely manipulate, validate, and transform them without bugs. For example, we can automatically clean up messy query strings from third-party APIs, standardize domain formats for global users, or redact sensitive info from logs. It’s a drop-in solution that saves dev time and reduces security risks, with zero licensing costs (MIT license). Think of it as ‘Laravel’s built-in URI sanitizer and query-string Swiss Army knife.’"

For Engineers: *"league/uri-components gives you immutable, PSR-7-compatible URI parts (scheme, host, path, query, etc.) with modern PHP features like BackedEnum support and fluent modifiers. Key wins:

  • Query strings: Chain methods like Query::filter()->map() for complex transformations.
  • Domains/Paths: Check subdomains (Domain::isSubdomainOf), find segments (Path::indexOf), or normalize IPs.
  • Security: Redact paths (Modifier::redactPathSegments) or validate IDNs without reinventing the wheel.
  • Interop: Works with Laravel’s Illuminate\Support\Facades\URL or standalone. Example use case: Replace a spaghetti str_replace mess for URL cleaning with Modifier::normalizeHost()->withoutEmptyQueryPairs(). Docs are solid, and it’s actively maintained (last release: 2026)."*
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.
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament