API Reference

Auto-gegenereerd via Reflection — blijft altijd in sync met src/.

Filter: alleAppCacheCmsDbDebugDynamicEventsFilesFormHtmlHttpImageLogMediaSecuritySessionStdlibSupportView

CachingTransport

Framework\Http\CachingTransport
final class

Decorator-Transport die GET/HEAD-responses naar disk cached.

Activatie per Request via {@see Request::withCacheTtl()}; zonder ttl
gaat de call rechtstreeks naar de inner transport (geen cache, geen schrijfwerk).

Cacht alleen 2xx-responses — error-responses worden niet bewaard.

__construct(\TransportInterface $inner, string $cacheDir)
2 public methods
invalidate(\Request $request): void
send(\Request $request): \Response

Client

Framework\Http\Client
final class

High-level facade boven {@see Transport}.

Wrapt veelgebruikte patronen (get, post, postJson) en houdt de Transport
herbruikbaar — dezelfde Client kan tegen elke Transport (curl, caching,
fake-in-test) draaien.

__construct(\TransportInterface $transport, \Headers $defaultHeaders = \Framework\Http\Headers::__set_state(array( 'values' => array ( ), 'originalCase' => array ( ), )))
4 public methods
get(\Url|string $url): \Response
post(\Url|string $url, ?string $body = NULL): \Response
postJson(\Url|string $url, array $data): \Response
send(\Request $request): \Response

CurlTransport

Framework\Http\CurlTransport
final class

Default Transport-implementatie via ext-curl.

Geen automatische debug-headers, geen ingebakken cache, geen JSON-decoding.
Eén verantwoordelijkheid: bytes heen, bytes terug.

__construct(?string $caInfo = NULL)
1 public method
send(\Request $request): \Response

Headers

Framework\Http\Headers
final class

Case-insensitive multi-value HTTP-headers.

Behoudt de oorspronkelijke schrijfwijze van een header (`Set-Cookie` blijft
`Set-Cookie`) maar matcht op lowercase, zoals de HTTP-spec voorschrijft.
Multi-value omdat headers als `Set-Cookie` of `Via` meerdere keren mogen
voorkomen — dat ging verloren in de oude `library/Http/Headers` (die
eigenlijk een `stdClass`-string-map was).

__construct(iterable $entries = array ( ))
11 public methods
get(string $name): ?string

Geef de eerste waarde, of null.

getAll(string $name): array
has(string $name): bool
names(): array
static parseResponseString(string $raw): self

Parse de raw response-header string van curl naar een Headers-object.
Slaat status-line en lege regels over.

toArray(): array
toAssociative(): array
toLines(): array

Plaag voor logging/curl: ['Name: value', ...]. Multi-values produceren
meerdere regels.

with(string $name, string $value): self
withAdded(string $name, string $value): self
without(string $name): self

HttpException

Framework\Http\HttpException
class

Gegooid bij netwerk-fouten, timeouts, of niet-decodeerbare responses.
HTTP-statuscodes 4xx/5xx leveren géén exception op — die staan in {@see Response}.

__construct(string $message, ?\Request $request = NULL, ?Throwable $previous = NULL)

Method

Framework\Http\Method
enum

HTTP-methodes — compleet in tegenstelling tot library/Http/RequestMethod
(die mist PUT/PATCH/HEAD/OPTIONS terwijl HEAD wél gebruikt wordt).

4 public methods
allowsBody(): bool

Mag deze methode een body hebben? (Strict gezien mag GET/HEAD/DELETE wel een body, maar in praktijk doe je dat niet.)

static cases(): array
static from(string|int $value): static
static tryFrom(string|int $value): ?static
Cases: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS

Request

Framework\Http\Request
final class

Immutable HTTP-request value-object.

Bevat alle informatie om een aanroep te doen — maar voert 'm niet uit.
Het uitvoeren is de verantwoordelijkheid van een {@see Transport}.

Bouw via with-pattern:

$req = (new Request(Method::GET, Url::parse('https://api.example.com/v1/items')))
->withHeader('Authorization', 'Bearer …')
->withQuery(['page' => 2])
->withTimeout(5.0)
->withCacheTtl(300);

__construct(\Method $method, \Url $url, \Headers $headers = \Framework\Http\Headers::__set_state(array( 'values' => array ( ), 'originalCase' => array ( ), )), ?string $body = NULL, float $timeout = 30.0, bool $followRedirects = true, bool $verifySsl = true, ?int $cacheTtl = NULL)
14 public methods
cacheKey(): string

Stabiele cache-key — voor {@see CachingTransport}. Sluit auth-headers uit
(Authorization, Cookie) zodat per-user requests niet de cache delen.

static get(\Url|string $url): self
static post(\Url|string $url, ?string $body = NULL): self
static postJson(\Url|string $url, array $data): self
withBody(?string $body): self
withCacheTtl(?int $seconds): self
withFollowRedirects(bool $follow): self
withHeader(string $name, string $value): self
withHeaders(\Headers $headers): self
withMethod(\Method $method): self
withQuery(array $query, bool $merge = true): self
withTimeout(float $seconds): self
withUrl(\Url $url): self
withVerifySsl(bool $verify): self

Response

Framework\Http\Response
final class

Immutable HTTP-response: status, headers, raw body.

In tegenstelling tot library/Http/Response wordt de body NIET automatisch
gedecodeerd — dat is opt-in via {@see json()} of {@see assoc()}.
Zo blijft de raw body altijd beschikbaar voor binaire/non-JSON responses.

__construct(int $status, \Headers $headers, string $body)
11 public methods
static asJson(?mixed $data, int $status = 200): self

Bouw een JSON-response. Naam is `asJson` (niet `json`) omdat de
instance-methode {@see Response::json()} al bestaat als decoder voor
inkomende responses.

assoc(): array
static html(string $body, int $status = 200): self

200 OK met `text/html`-Content-Type — de standaard voor pagina-handlers.

isClientError(): bool
isOk(): bool
isRedirect(): bool
isServerError(): bool
json(bool $associative = false): ?mixed

Decodeer de body als JSON. Geeft null bij parse-fouten.
Gebruik {@see assoc()} als je een associative-array wil.

static notFound(string $body = '404 Not Found'): self

404 met optionele body — handig in een fallback-route.

static redirect(string $location, int $status = 302): self

302 Found (default) of een andere 3xx; lege body, alleen `Location`-header.

static text(string $body, int $status = 200): self

200 OK met `text/plain`-Content-Type.

ServerRequest

Framework\Http\ServerRequest
final class

Inbound HTTP-request — de aanvraag die de server ontvangt.

Naast de PSR-7-achtige opzet (method/url/headers/body) zit er ergonomie op:
- query/body als {@see Parameters} → typed coercion via define()
- cookies als Parameters
- JSON-body wordt automatisch geparsed als Content-Type application/json is
(PHP's $_POST is dan leeg)
- clientIp() kijkt naar X-Forwarded-For voor reverse-proxies

Immutable: with*-methodes geven een nieuwe instance terug. Routes gebruiken
dat om route-params toe te voegen zonder de "huidige" request te muteren.

__construct(\Method $method, \Url $url, \Headers $headers, \Parameters $query, \Parameters $body, \Parameters $cookies, string $rawBody = '', array $routeParams = array ( ))
7 public methods
static capture(): self

Bouw een ServerRequest uit globals (PHP-FPM / mod_php). Voor tests:
gebruik de constructor direct met je eigen waarden.

clientIp(array $trustedProxies = array ( )): string

Geeft het IP van de client. Vertrouwt X-Forwarded-For alleen als REMOTE_ADDR
in $trustedProxies staat — anders gebruik je domweg REMOTE_ADDR.

isAjax(): bool
isJson(): bool
isPost(): bool
param(int $index, string $default = ''): string

Route-parameter op positie-index (capture-group uit het pattern).

withRouteParams(array $params): self

TransportInterface

Framework\Http\TransportInterface
interface

Stuurt een {@see Request} de wereld in en levert een {@see Response} op.

Implementaties:
- {@see CurlTransport} — echte HTTP-call via curl
- {@see CachingTransport} — decorator die cache-hits buiten de inner-transport om afhandelt
- tests gebruiken meestal een eigen FakeTransport

1 public method
send(\Request $request): \Response

Url

Framework\Http\Url
final class

Immutable URL-value-object met fluent with*-pattern voor query-merging.

Vervangt de mix van parse_url + http_build_query + handmatige fallback
uit library/Http/Request.

__construct(string $scheme = 'https', string $host = '', ?int $port = NULL, string $path = '/', array $query = array ( ), ?string $fragment = NULL, ?string $user = NULL, ?string $pass = NULL)
6 public methods
static parse(string $url): self
relative(): string

Pad + query + fragment, zónder scheme/host.

withParam(string $name, ?mixed $value): self

Voeg/overschrijf één query-parameter.

withPath(string $path): self
withQuery(array $extra, bool $merge = true): self
withoutParam(string $name): self

Verwijder één query-parameter.

ImageHandler

Framework\Image\Http\ImageHandler
final class

HTTP-handler voor `/img/...`-routes.

Flow:
1. Parse URL → ParsedUrl (intern hash óf extern URL + sig-verify)
2. Variant-cache check → hit: serve direct, miss: stap 3
3. Resolve source-bytes (FileStorage óf remote-fetch+ingest)
4. StillFrame-extractie (passthrough / GIF frame 0 / video frame via ffmpeg)
Voor video: tussencache zodat ffmpeg niet per maat opnieuw runt
5. Transform via backend
6. Schrijf naar variant-cache zodat nginx volgende requests direct serveert

__construct(\UrlParser $urlParser, \FileStorageSource $internalSource, \RemoteUrlSource $remoteSource, \StillFrameRegistry $stillFrames, \Transformer $transformer, \VariantCache $variantCache, \VariantCache $frameCache)