This release brings serious firepower to server-side HTTP handling. The headline is a brand-new SSRF defense kit β IPAddress and UrlValidator let you validate URLs and pin connections before your app ever talks to an attacker-controlled host. On top of that, cookie handling gets a modern overhaul with a type-safe SameSite enum, CHIPS/Partitioned support, and a proper Max-Age attribute, while the new Request::isFrom() gives you reliable same-site request detection β even on Safari. Now on PHP 8.3.
Changes
- PHP 8.3 is now required. Time to upgrade your runtime if you haven't already.
UserStorageis gone β the long-deprecated class has been removed. Use the standard authentication storage instead.Request::getRemoteHost()is deprecated and now returnsnullβ reverse DNS lookups were slow, unreliable, and a privacy footgun. Resolve the hostname yourself fromgetRemoteAddress()if you really need it (#218).
Deprecations (still working, but plan ahead)
- The
IResponse::SameSite*constants are deprecated in favor of the newSameSiteenum. Request::isSameSite()is deprecated β useisFrom()instead.- Passing integer
0as the expiration toResponse::setCookie()is deprecated β usenullfor a session cookie.
β¨ New Features
- SSRF protection, batteries included β the new IPAddress is an immutable IPv4/IPv6 value object with rich predicates (
isPublic(),isPrivate(),isLoopback(),isLinkLocal(),isMulticast(),isReserved()), CIDR matching viaisInRange(), and IPv4-mapped IPv6 normalization. Pair it with UrlValidator, a configurable guard that vets scheme, port, host allow/blocklists, userinfo, and β optionally with DNS β the resolved IP ranges. It even hands back the resolved IPs so you can pin the connection throughCURLOPT_RESOLVEand defeat DNS-rebinding. Request::isFrom()β a single, reliable way to check where a request came from, withsite,dest, anduserparameters built on theSec-Fetch-*headers. For browsers withoutSec-Fetchsupport (Safari < 16.4), it transparently falls back to a strict cookie, so same-site detection just works everywhere.- Type-safe
SameSiteenum βsetCookie()andSessionnow accept a proper enum instead of magic strings, so typos become compile-time problems, not silent security holes. Response::setCookie()speaks modern cookie β it now supports thePartitionedattribute (CHIPS) for third-party cookies, emits aMax-Ageattribute (which takes precedence overexpiresand ignores the client clock), and forcesSecureautomatically whenSameSite=None, sparing you a browser rejection.Helpers::expirationToSeconds()β one consistent parser for every expiration value across the library. Numbers are relative seconds, whileDateTimeInterfaceand textual strings like'20 minutes'or'2024-01-01'resolve as absolute times; each caller decides whatnullmeans in its own context.Helpers::parseQualityList()β parses HTTP quality-value lists (Accept,Accept-Language, β¦) into a ranked token map.Request::detectLanguage()was rewritten on top of it and is more correct as a result.