Nexus API Reference

Application

Tags
psalm-api

Defines the HTTP surface (every method nexus-http's HttpApp exposes today) plus compile(). Concrete impls: HttpApplication (HTTP-only) and WsApplication (decorator that adds WebSocket).

Table of Contents

Methods

actor()  : ActorRegistration
clearRouteCache()  : void
compile()  : CompiledApplication
delete()  : RouteBuilder
discover()  : self
errorMode()  : self
get()  : RouteBuilder
group()  : RouteGroup
middleware()  : self
onException()  : self
paramResolver()  : self
patch()  : RouteBuilder
perRequestActor()  : ActorRegistration
post()  : RouteBuilder
put()  : RouteBuilder
registeredRoutes()  : array<int, RouteSummary>
Snapshot of every route registered so far. Intended for index pages, smoke tests, and admin/debugging tooling.
requiresPoolSingleton()  : bool
withMessageSerializer()  : self
withoutDefaultExceptionHandler()  : self
withPoolSingletonSpawner()  : self
withRouteCache()  : self

Methods

delete()

public delete(string $path, class-string|Closure $handler) : RouteBuilder
Parameters
$path : string
$handler : class-string|Closure

See self::get() for the closure contract.

Return values
RouteBuilder

discover()

public discover(string $directory) : self
Parameters
$directory : string
Return values
self

get()

public get(string $path, class-string|Closure $handler) : RouteBuilder
Parameters
$path : string
$handler : class-string|Closure

Either a class FQN whose __invoke is resolved by the registry, or a Closure whose params are resolved by registered ParamResolvers (#[FromPrincipal], #[FromBody], ServerRequestInterface, ...) and which returns either a ResponseInterface or a Future<ResponseInterface>.

Return values
RouteBuilder

middleware()

public middleware(string|MiddlewareInterface $middleware) : self
Parameters
$middleware : string|MiddlewareInterface
Return values
self

onException()

public onException(TException> $exceptionClass, callable(TException, ServerRequestInterface): ResponseInterface $mapper) : self
Parameters
$exceptionClass : TException>
$mapper : callable(TException, ServerRequestInterface): ResponseInterface
Tags
template

TException of Throwable

Return values
self

patch()

public patch(string $path, class-string|Closure $handler) : RouteBuilder
Parameters
$path : string
$handler : class-string|Closure

See self::get() for the closure contract.

Return values
RouteBuilder

post()

public post(string $path, class-string|Closure $handler) : RouteBuilder
Parameters
$path : string
$handler : class-string|Closure

See self::get() for the closure contract.

Return values
RouteBuilder

put()

public put(string $path, class-string|Closure $handler) : RouteBuilder
Parameters
$path : string
$handler : class-string|Closure

See self::get() for the closure contract.

Return values
RouteBuilder

registeredRoutes()

Snapshot of every route registered so far. Intended for index pages, smoke tests, and admin/debugging tooling.

public registeredRoutes() : array<int, RouteSummary>
Return values
array<int, RouteSummary>

requiresPoolSingleton()

public requiresPoolSingleton() : bool
Return values
bool

withoutDefaultExceptionHandler()

public withoutDefaultExceptionHandler() : self
Return values
self

withRouteCache()

public withRouteCache(CacheInterface $cache[, string|null $key = null ]) : self
Parameters
$cache : CacheInterface
$key : string|null = null
Return values
self

        
On this page

Search results