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 Laravel Package

zenstruck/uri

Immutable, fluent URI/URL value objects for PHP with easy parsing, building, and modification of URIs. Create, normalize, and manipulate components (scheme, host, path, query, fragment) safely, with helpers for encoding and query params.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • URL Consistency & Validation: Enables standardized URL handling across microservices, APIs, and frontend/backend systems, reducing edge-case bugs (e.g., malformed URLs, missing schemes).
  • Feature Roadmap for URL-Centric Products:
    • SEO Tools: Programmatically generate, validate, and modify URLs for content management systems (CMS) or link analysis tools.
    • API Gateways: Sanitize and transform incoming/outgoing URLs (e.g., rewriting paths for legacy systems or A/B testing).
    • Single Sign-On (SSO): Safely parse and reconstruct auth redirect URLs with query parameters.
  • Build vs. Buy:
    • Buy: Avoid reinventing URL parsing logic (e.g., regex-heavy solutions or manual parse_url() usage).
    • Build: Only if needing highly custom URL schemas (e.g., non-standard protocols) not covered by this package.
  • Use Cases:
    • Data Migration: Normalize URLs in databases (e.g., converting http:// to https://).
    • Analytics: Track and compare URL structures (e.g., query parameter patterns).
    • Security: Detect and block malicious URLs (e.g., XSS payloads in query strings).

When to Consider This Package

  • Adopt If:

    • Your PHP/Laravel app frequently manipulates URLs (e.g., >50% of API endpoints or frontend routes).
    • You need immutable URL objects with fluent methods (e.g., Uri::create()->withQuery(['utm_source' => 'email'])).
    • Your team lacks time to maintain custom URL parsing logic or relies on parse_url()/parse_str().
    • You require type safety (e.g., auto-detection of invalid schemes like javascript:).
    • Compatibility with Laravel’s Illuminate\Support\Uri is desired (this package extends it).
  • Look Elsewhere If:

    • You’re using non-PHP stacks (e.g., Node.js, Python) or need cross-language URL tools.
    • Your URLs are extremely complex (e.g., custom protocols with nested delimiters) and require bespoke parsing.
    • You prioritize minimal dependencies and this package’s ~10KB adds overhead.
    • Your team prefers functional programming over OOP for URL manipulation.

How to Pitch It (Stakeholders)

For Executives: "This package lets us treat URLs as first-class objects—like dates or money—reducing bugs in links, redirects, and APIs. For example, instead of fragile string concatenation for tracking pixels (?utm_source=email), we’d use Uri::create()->withQuery(['utm_source' => 'email'])—cleaner, safer, and reusable. It’s a 10-minute integration that saves hours of debugging malformed URLs, especially critical for SEO tools or multi-service architectures. MIT-licensed and actively maintained, with zero vendor lock-in."

For Engineering: *"Zenstruck/Uri gives us:

  • Fluent API: Chain methods like Uri::create()->withPath('/new')->withFragment('section').
  • Validation: Auto-detects invalid schemes (e.g., data:) or missing TLDs.
  • Laravel Integration: Works seamlessly with Laravel’s Uri class.
  • Testability: Immutable objects make URL logic easier to mock in tests. Tradeoff: Adds ~10KB to your vendor folder. Worth it if URLs are a core concern."*
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.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor