Skip to content

Transport

class Vendidit\AuthServer\Contracts\Transport Source: src/Contracts/Transport.php

Thin port over PSR-18 + PSR-17. One method per auth-server endpoint.

Each method’s URL maps to a row in auth-server/internal/api/routes/routes.go. Wire shape is snake_case (parity with auth-client TS reference). Response arrays are decoded JSON with original keys preserved; the Laravel adapter can renormalize for app code if it wants.

Implementations:

  • HttpTransport (PSR-18-backed, the default)
  • InMemoryTransport (tests; canned responses)

Methods

`request(string $method,

string $path,
?array $body = null,
array $headers = [],
?string $accessToken = null,)`

Send a JSON request. Returns the decoded body. Throws an appropriate VenAuthException subclass on non-2xx responses (status → class via ErrorMapper) or NetworkException on transport failure.

@param string $method HTTP method (POST/GET/PUT/DELETE) @param string $path Path appended to baseUrl + apiPrefix (e.g. “/auth/login”) @param array<string,mixed>|null $body JSON body, null = no body @param array<string,string> $headers Extra headers (Authorization auto-attached if accessToken set) @param string|null $accessToken Bearer token to attach

@return array<string,mixed>