league/uri-components
Immutable value-object URI components for PHP. Build, validate, normalize and convert parts like scheme, authority, host, path, query and fragment with PSR-7 compatibility. Supports IDN hosts (intl/polyfill) and IPv4 conversion.
uri 7.8.1BackedEnumQuery::hasListQuery::getListQuery::withListQuery::appendListQuery::withoutListQuery::withoutListsQuery::onlyListsQuery::countDistinctKeysQuery::isNotEmptyQuery::mapQuery::filterQuery::indexOfValueQuery::valueAtQuery::keyAtQuery::pairURLSearchParams::countDistinctKeysURLSearchParams::tapDomain::isSubdomainOfDomain::hasSubdomainDomain::isSiblingOfDomain::parentHosDomain::commonAncestorWithtransform method to Immutable classesQuery and Modifier methods can opt to switch to different query string extraction using the new $extractMode parameter.Query and Modifier methods can opt to switch to different query string composition using the new $composeMode parameter.Query and Modifier methods can opt to switch to different type coercion using the new $coercionMode parameter.URLSearchParams::uniqueKeyCount use URLSearchParams::countDistinctKeys insteadDomain::first returns the first domain labelDomain::last returns the last domain labelDomain::contains tells wether the label is present in the domainDomain::indexOf returns the index of the first occurrence of the labelDomain::lastIndexOf returns the index of the last occurrence of the labelDomain::isEmpty tells whether the domain is empty or not (contains at least on label)HierarchicalPath::first returns the first segmentHierarchicalPath::last returns the last segmentHierarchicalPath::contains tells whether the segment is present in the pathHierarchicalPath::indexOf returns the index of the first occurrence of the segmentHierarchicalPath::lastIndexOf returns the index of the last occurrence of the segmentHierarchicalPath::isEmpty tells whether the path is empty or not (contains at least on segment)Query::first returns the first value for a given query key pairQuery::last returns the last value for a given query key pairQuery::isEmpty tells whether the query is empty or notURLSearchParams::first returns the first value for a given query key pairURLSearchParams::last returns the last value for a given query key pairURLSearchParams::hasValue an alias of using URLSearchParams::has with 2 parametersURLSearchParams::deleteValue an alias of using URLSearchParams::delete with 2 parametersModifier::redactUserInfo redacts the user info component if presentModifier::redactPathSegments redacts specific path segments if presentModifier::redactPathNextSegments redacts specific path next segments if presentModifier::redactPathSegmentsByOffset redacts specific path segments by offset if presentModifier::redactQueryPairs redacts specific query pair if presentModifier::prependQuery prepend a query string to the URI query componentModifier::prependPath replace Modifier::prependSegmentModifier::appendPath replace Modifier::appendSegmentModifier::prependSegmentsModifier::appendSegmentsModifier::uri() method 166 by meyerbaptisteSensitiveParameter usage on Modifier::withUserInfo methodHostRecord classModifier::withPath improve handling of path leading slash presence for PSR-7 implementing classesModifier::prependSegment use Modifier::prependPath insteadModifier::appendSegment use Modifier::appendPath insteadUriComponentInterface::equals methodFragmentDirectives supportComponent::when conditional method to ease component building logic.URLSearchParams::when conditional method to ease component building logic.Modifier::prependQueryParameters returns a modifier with prepended query parametersModifier::replaceQueryParameter returns a modifier with part of its query string replacedModifier::replaceQueryPair returns a modifier with part of its query string replacedModifier::when conditional method to ease component building logic.Modifier::normalizeIp returns the host normalized for IPv6 and IPv4 addressesModifier::normalizeHost returns the host as normalized by the WHATWG algorithmModifier::with* method from the underlying Uri object are proxy to improve DX.Modifier::wrap static method which wraps the underlying URI object used by the Modifier class.Modifier::unwrap method which returns the underlying URI object used by the Modifier class.Modifier::prefixQueryPairs and Modifier::prefixQueryParameters to prefix Query using the pair key or the parameter namesModifier::toMarkdownAnchor returns the Markdown string representation of the anchor tag with the current instance as its href attribute.Modifier::toHtmlAnchor returns the HTML string representation of the anchor tag with the current instance as its href attribute.tryNew named constructor added to all classes to return a new instance on success or null on failure.Query::decoded the string representation of the component decoded.Query::normalizedQuery::fromPairs and Query::fromVariable takes a optional $prefix parameter to update the query pair keys or parameter namesQuery::indexOf and Query::replaceQuery::mergeParametersQuery::replaceParameterQuery::replacePairQuery::prependURLSearchParams::decoded the string representation of the component decoded.Path::nornalizedFragment::normalizedHierarchicalPath::normalizedDatapath::normalizedUri\Rfc3986\UriUri\WhatWg\UrlPort::defaultSchemesPort::defaultSchemeScheme::isWhatWgSpecialScheme::defaultPortScheme::hasDefaultPortModifier host related method return host in IDN form or ASCII form depending on the URI input formatUserInfo now can be constructed and mutated even when the user component is not present. It was throwing an exception before.Modifier::getIdnUriString use Modifier::toDisplayString insteadModifier::getUriString use Modifier::toString insteadModifier::getUri use Modifier::uri insteadModifier::from use Modifier::wrap insteadFull Changelog:
UrlSearchParams::uniqueKeyCountModifier::getIdnUriStringModifier::hostToIpv6CompressedModifier::hostToIpv6ExpandedScheme::isHttpScheme::isWebsocketScheme::isSslScheme::isSpecialDeprecated attribute to signal deprecated public API methods and constants.UriInterface in UrlSearchParams classfromUri to return the same value for the component if the URI object has the same string representation.UriFactoryInterface is deprecated in Modifier classremoveEmptyPairs #133Query::fromVariableUrlSearchParams::fromVariableQuery::fromParameters use Query::fromVariable insteadUrlSearchParams::fromParameters use UrlSearchParams::fromVariable insteadLeague\Uri\Modifier::removeQueryPairsByKeyLeague\Uri\Modifier::removeQueryPairsByValueLeague\Uri\Modifier::removeQueryPairsByKeyValueLeague\Uri\Components\Query::hasPairLeague\Uri\Components\Query::withoutPairByKeyLeague\Uri\Components\Query::withoutPairByValueLeague\Uri\Components\Query::withoutPairByKeyValueLeague\Uri\Components\Query::fromFormDataLeague\Uri\Components\Query::toFormDataLeague\Uri\Components\URLSearchParamsLeague\Uri\Components\Query::sort to improve WHATWG compliance.League\Uri\QueryString::buildFromPairs should throw SyntaxError instead of TypeErrorLeague\Uri\Components\Query uses internally League\Uri\KeyValuePair\ConverterLeague\Uri\Components\Query::toRFC3986 is no longer deprecatedLeague\Uri\Components\Query::jsonSerualize uses toFormData instead of toRFC1738League\Uri\Components\Query fix float handling.League\Uri\Modifier::removeQueryPairs use League\Uri\Modifier::removeQueryPairsByKey instead.League\Uri\Components\Query::withoutPair use League\Uri\Components\Query::withoutPairByKey instead.Fix composer.json
Modifier::appendQueryPairsModifier::mergeQueryPairsModifier::removeQueryPairsModifier::removeEmptyQueryPairsModifier::appendQueryParametersModifier::mergeQueryParametersModifier::removeQueryParametersModifier::removeQueryParametersIndicesModifier::removeParams use Modifier::removeQueryParameters insteadModifier::removePairs use Modifier::removeQueryPairs insteadModifier::removeEmptyPairs use Modifier::removeEmptyQueryPairs insteadModifier::encodeQueryEncoder class to normalize encoding and decoding in all packagesFull Changelog: https://github.com/thephpleague/uri-components/compare/7.0.0...7.1.0
Full Changelog: https://github.com/thephpleague/uri-components/compare/2.4.1...2.4.2
value method to replace the removed getContent method.League\Uri package.League\Uri\Components\Scheme::new named constructorLeague\Uri\Components\UserInfo::new named constructorLeague\Uri\Components\Host::new named constructorLeague\Uri\Components\Domain::new named constructorLeague\Uri\Components\Fragment::new named constructorLeague\Uri\Components\Query::new named constructorLeague\Uri\Components\Path::new named constructorLeague\Uri\Components\DataPath::new named constructorLeague\Uri\Components\UserInfo::withUser modifier methodLeague\Uri\Components\UserInfo::withPass modifier methodLeague\Uri\Components\Port::fromNumber modifier methodLeague\Uri\Components\Query::parameters accessing methodLeague\Uri\Components\Query::parameter accessing methodLeague\Uri\Components\Query::hasParameter accessing methodLeague\Uri\IPv4Calculators\MissingIPv4Calculator exceptionLeague\Uri\Components\OffsetOutOfBounds exception addedLeague\Uri\Modifier to replace deprecated League\Uri\Modifierprivate readonly where possible.UserInfo and the Authority classes) are made private use the available named constructors instead::new() named constructor instead.UserInfo class makes a distinction between null and the empty string.Query::has accessing method accept a variadic parameters to check multiple keys at the same time.Domain value can be null or a non-empty string previously it would trigger an exceptionDomain::append and Domain::prepend respects the root status of the instance.createFromString named constructors are replaced by the new named constructor.createFromNull named constructors are replaced by the new named constructor.createFrom* replaced by the same method starting with from*. For example Authority::createFromUri is deprecated in favor of Authority::fromUriQuery::params is replaced by Query::parameters and Query::parameterHierarchicalPath::segments use HierarchicalPath::getIterator insteadDomain::labels use Domain::getIterator insteadLeague\Uri\UriModifier use League\Uri\ModifierLeague\Uri\IPv4Normalizer use League\Uri\Modifier insteadwithContent and getContent methods__set_statefloat type as possible argument for componentsint type as possible argument for componentsUserInfo::withUserInfo modifier method use UserInfo::withUser and/or UserInfo::withPass insteadExceptions namespaceLeague\Uri\Exceptions\IPv4CalculatorMissing use League\Uri\IPv4Calculators\MissingIPv4Calculator insteadLeague\Uri\Exceptions\OffsetOutOfBounds use League\Uri\Components\OffsetOutOfBounds insteadLeague\Uri\QueryString class. Class moved to the uri-interfaces package.Full Changelog: https://github.com/thephpleague/uri-components/compare/7.0.0-beta.2...7.0.0
Pre-release
Component::toStringIDNA conversion in now normalize using the Uri-Interface package classesAuthority::createFromNullAuthority::createFromStringAuthority::createFromComponentsDataPath::createFromFilePathDataPath::createFromStringDomain::createFromStringDomain::createFromHostHierarchicalPath::createFromPathHierarchicalPath::createFromStringPath::createFromStringPHP8.0QueryString::buildUriModifier using the newly added named constructors.Authority::__construct replaced by Authority named constructorsDataPath::createFromPath replaced by DataPath::createFromFilePathDomain::__construct replaced by Domain named constructorsHierarchicalPath::__construct replaced by HierarchicalPath named constructorsPHP7.2DataUri by #154 thanks to Nicolas Grekasext-fileinfo PHP extensions see #154 thanks Nicolas GrekasLeague\Uri\UriModifier::removeEmptyPairs - to remove empty pairs from the URL object.League\Uri\UriModifier with a better distinction between empty and undefined URI component.League\Uri\IPv4HostNormalizer to ease IPV4 host string normalization.League\Uri\UriModifier to ease manipulating League\Uri\UriInterface and Psr\Http\Message\UriInterface implementing objects.League\Uri\QueryString to parse, extract and build query string and parametersLeague\Uri\Contracts\ComponentInterfacecreateFromUri named constructor to instantiate a component object from a URI objectLeague\Uri\Components\Authority to represent the URI authority componentLeague\Uri\Components\Fragment::decoded to return the safely decoded fragment contentLeague\Uri\Components\UserInfo::decoded to return the safely decoded user info contentLeague\Uri\Components\Port::toInt to return the int representation of the Port or nullLeague\Uri\Components\Domain to better process domain hostLeague\Uri\Components\HierarchicalPath::createAbsoluteFromSegmentsLeague\Uri\Components\HierarchicalPath::createRelativeFromSegmentsLeague\Uri\Components\HierarchicalPath::segments to return the component segmentsLeague\Uri\Components\HierarchicalPath::get to return a specific segmentLeague\Uri\Components\Query follows more closely the URLSearchParams specifications from the WHATWG groupLeague\Uri\Components\Query::createFromRFC3986 to return a new object from a RFC3986 query stringLeague\Uri\Components\Query::createFromRFC1738 to return a new object from a RFC1738 query stringLeague\Uri\Components\Query::toRFC3986 to return a RFC3986 query stringLeague\Uri\Components\Query::toRFC1738 to return a RFC1738 query stringfinalgetContent no-longer takes any parameterHost objects throws League\Uri\Exception\IdnSupportMissing on mis-configured or absent Intl extension presence.UserInfo::__construct expects two arguments the user and the pass instead of one.Query::__construct is now privatePHP7.0PHP7.1isEmpty and isNull methods are removedLeague\Uri\parse_queryLeague\Uri\build_queryLeague\Uri\extract_queryLeague\Uri\pairs_to_paramsLeague\Uri\QueryBuilderLeague\Uri\QueryParserLeague\Uri\Components\ComponentInterfaceLeague\Uri\Components\HierarchicalPath::createFromSegmentsLeague\Uri\Components\HierarchicalPath::getSegmentsLeague\Uri\Components\HierarchicalPath::getSegmentLeague\Uri\Components\HierarchicalPath::IS_ABSOLUTELeague\Uri\Components\HierarchicalPath::IS_RELATIVELeague\Uri\Components\Domain classLeague\Uri\Components\Host::isAbsoluteLeague\Uri\Components\Host::getLabelsLeague\Uri\Components\Host::getLabelLeague\Uri\Components\Host::keysLeague\Uri\Components\Host::countLeague\Uri\Components\Host::getIteratorLeague\Uri\Components\Host::appendLeague\Uri\Components\Host::prependLeague\Uri\Components\Host::replaceLabelLeague\Uri\Components\Host::withoutLabelsLeague\Uri\Components\Host::withRootLabelLeague\Uri\Components\Host::withoutRootLabelLeague\Uri\Components\Query::ksortLeague\Uri\Components\Query::getParamsLeague\Uri\Components\Query::getParamLeague\Uri\Components\Query::getPairsLeague\Uri\Components\Query::getPairLeague\Uri\Components\Query::hasPairLeague\Uri\Components\Exception usage in League\Uri\QueryParser and League\Uri\QueryBuilder0.mbstring extension requirementHost resolver and its usage is lazyloaded so that Host only requires and used them if neededHost::withPublicSuffixHost::withRegistrableDomainHost::withSubDomain
methods that were leaving the current Host object corrupted in some cases.Host::__construct can take an optional Rules object as the domain resolverHost::createFromIp can take an optional Rules object as the domain resolverHost::createFromLabels can take an optional Rules object as the domain resolverHost::withDomainResolver to enable switching to current domain resolver objectThe domain resolver as a Rules object is now injecting into the Host domain so that its data can be cached independently of the filecache. If not domain resolver is provided the Host will fallback to using the filecache with the data being kept for 7 days in a vendor subdirectory.
Decoupled the QueryBuilder and the QueryParser from ComponentTrait
Host::withPublicSuffix to complete domain name manipulation methodsUri\QueryParser class to parse any string into key/pair value or extract PHP valuesUri\QueryBuilder class to build a valid query string from a collection of Key/pair valuesUri\pairs_to_params alias for QueryParser::convertQuery::parse replaced by QueryParser::parseQuery::extract replaced by QueryParser::extractQuery::build replaced by QueryBuilder::buildHost::getRegisterableDomain replaced by Host::getRegistrableDomainHost::withRegisterableDomain replaced by Host::withRegistrableDomainQueryParserTrait, HostInfoTraitHow can I help you explore Laravel packages today?