Skip to content
rw3iss Auth

Transport

class rw3iss\AuthServer\Contracts\Transport 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()

function request(
string $method,
string $path,
?array $body = null,
array $headers = [],
?string $accessToken = null,
): array;

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.

Parameters

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

Returns

  • array<string,mixed>