Download the PHP package dealnews/url without Composer
On this page you can find all versions of the php package dealnews/url. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package url
DealNews URL Utilities
Utilities for parsing, normalizing, merging, and building URLs with fine‑grained control over query strings.
Installation
Classes
DealNews\Url\Url
High level URL helper that stores individual URL parts (scheme, host, path, query, etc.) and keeps a QueryString helper in sync with the query property.
Key capabilities:
parse(string $url, bool $reset = true, ?string $separator = null)– split a URL into parts and validate each component.- Magic setters/getters (
$url->host,$url->path,$url->query, …) – allow direct manipulation of parts with validation. build(?string $separator = null)– rebuild the URL, omitting default ports and honoring custom separators.normalize()– lowercases scheme/host, sorts query parameters, and normalizes percent‑encoding.sanitizePathComponent(string $input)– generate safe slug/path fragments.merge(string $url1, string ...$url2)– merge one or more URLs into the current instance without mutating the original data.
Example:
DealNews\Url\QueryString
Lightweight parser/builder for ordered query strings. Allows unnamed entries, custom separators, front insertion, and selective replacement.
Key methods:
parse(string $query_string, string $separator = '&')build(?string $separator = null): stringaddParameter(?string $key, ?string $value, bool $front = false)setParameter(?string $key, ?string $value, bool $front = false)removeParameters(array $keys): voidsortParameters(): voidgetParameters(): array
Example:
Custom separator example:
DealNews\Url\Exception\Parse
Custom exception extending \Exception. Methods such as Url::__construct() and Url::__set() throw Parse when a URL cannot be parsed or an invalid property is referenced.