- Is league/url compatible with Laravel?
- league/url is framework-agnostic, so it can be installed in a Laravel project as a plain Composer dependency, but it has no Laravel service provider, facade, config file, or container binding. There is no Laravel integration to configure. For Laravel 11.x and later, the built-in Illuminate\Support\Uri is the more idiomatic choice for URL handling.
- How do I install league/url with Composer?
- Run composer require league/url and call the classes directly from your application code. No service provider or facade registration is needed, and there is no configuration to publish. Because the package is framework-agnostic, installation is the same in Laravel and in any other PHP project.
- Does league/url support PHP 8.2 and PHP 8.3?
- PHP 8.2+ support is not confirmed by the available context. Composer may still resolve league/url on PHP 8.x, so a successful install does not prove runtime compatibility. Check the 3.3.5 tag's composer.json constraint, source code, and CI matrix directly before adopting it.
- What is the difference between league/url and league/uri?
- league/uri is the maintained successor to league/url and is the better default for new code. league/url still provides immutable Url, Query, and Path objects for parsing and manipulating URLs, but its maintenance is low-velocity and opaque. If you are evaluating a URL library today, start with league/uri or Laravel's Illuminate\Support\Uri.
- Is league/url still maintained?
- The project appears low-velocity and opaque rather than definitively abandoned. A 3.3.5 release exists with a merged change, which contradicts earlier claims of no releases, but the release date, maintainer, and repository status are not established here. Treat a one-line patch after long dormancy as a reason to pin, not a reason to adopt.
- Should I use league/url for a new Laravel project?
- For a new Laravel project, no. league/uri, guzzlehttp/psr7's Uri, or Illuminate\Support\Uri in Laravel 11.x+ are safer and more idiomatic options. league/url is functionally redundant for most Laravel applications and carries unverified PHP 8 runtime risk.
- How do I parse and modify a URL with league/url?
- Create a Url object from an existing URL string, then use the fluent API to read or change the scheme, host, port, user, password, path, query, and fragment. Query and Path are separate immutable objects, so you rebuild a URL rather than concatenating strings. Serialize the final object back to a string when you need to use it.
- Does league/url handle RFC 3986 encoding and validation?
- Yes. league/url provides automatic RFC 3986 encoding and validation and parses existing URLs without losing data. That said, URL parsing is a classic SSRF and open-redirect surface, and the package has no documented security response process. Validate untrusted URLs against an allowlist in your application regardless of library.
- What are the alternatives to league/url for Laravel?
- The main alternatives are league/uri, guzzlehttp/psr7\Uri, and Illuminate\Support\Uri, which is available in Laravel 11.x and later. All three are actively relevant for Laravel work, while league/url is framework-agnostic and has no Laravel glue. Choose based on whether you need PSR-7 interoperability or a Laravel-native API.
- What risks should I check before adopting league/url?
- Verify PHP 8.1, 8.2, and 8.3 support against the 3.3.5 tag and its CI matrix, and confirm the tag is signed or attributable to a known committer. Check whether the repository is still archived and whether ownership changed. Because 3.3.5 changed relative-path resolution without a minor bump, also audit call sites where signing, redirect allowlists, or cache keys depend on path parsing.