zendframework/zend-uri
zend-uri is a PHP component for parsing, validating, normalizing, and building URIs. It supports common schemes, handles encoding and edge cases, and provides a consistent API for working with URLs in Zend Framework and standalone projects.
This package provides a robust, RFC-compliant URI handling class (Zend\Uri\Uri) for validating, parsing, and manipulating Uniform Resource Identifiers. Since the package is archived and no longer actively maintained (last release: 2019), it’s primarily useful in legacy Zend Framework or Laminas projects, or if you specifically require its validation behavior. First steps:
composer require zendframework/zend-uriuse Zend\Uri\Uri;$uri = new Uri('http://example.com/foo?bar=baz');
$isValid = $uri->isValid(); // true
$normalized = $uri->toString(); // 'http://example.com/foo?bar=baz'
isValid() to sanitize user-provided URIs before use in redirects, API integrations, or SSO flows.$uri->setHost('api.example.com');
$uri->setQueryParam('token', 'abc123');
$uri = Uri::factory('https://');
$uri->setPath('/users');
resolve():
$base = new Uri('http://example.com/path/');
$relative = new Uri('../other?q=1');
$absolute = $base->resolve($relative)->toString(); // 'http://example.com/other?q=1'
$uri->setEncoding('UTF-8') won’t automatically handle multibyte hosts—use idn_to_ascii() first for international domains).setQueryParam() overwrites existing values—use addQueryParam() for appending (e.g., multi-value ?tag=1&tag=2).guzzlehttp/psr7 unless you wrap it or convert manually.vendor/autoload.php is included, as PSR-4 rules require correct namespace mapping.Uri to add custom scheme validation (e.g., myapp://) by overriding validate() in a subclass.How can I help you explore Laravel packages today?