Raydium Framework

App
in package
implements RequestHandlerInterface

Interfaces, Classes, Traits and Enums

RequestHandlerInterface

Table of Contents

$configs  : Configs
$container  : Container
$defaultHandler  : null|callable
$emitter  : SapiEmitter
$errorHandler  : null|callable
$exception  : null|Throwable
$finalRequest  : ServerRequestInterface
$middlewareFilter  : array<string|int, mixed>
$middlewareRegistry  : MiddlewareRegistry
$psrContainer  : Container
$request  : ServerRequestInterface
$response  : ResponseInterface
__construct()  : mixed
App constructor.
add()  : static
Add middleware to the application via MiddlewareRegistry.
filter()  : void
Filter middlewares.
getContainer()  : Container
handle()  : ResponseInterface
The PSR-15 compliant method to handle a request.
registerService()  : Container
Add a binding to the container.
run()  : void
setDefaultHandler()  : static
Set the default handler that processes the final request if no other middleware modifies it.
setErrorHandler()  : static
Set the error handler middleware.
emitResponse()  : void
handleException()  : ResponseInterface
Method to handle exceptions using the defined error handler.
terminateWithException()  : void
Handles exception termination with context.
withMiddleware()  : static
Add middleware to the application via MiddlewareRegistry.
httpException()  : Throwable
Handles exceptions and ensures they are converted to an HTTP exception if necessary.

Properties

$container

protected Container $container

$defaultHandler

protected null|callable $defaultHandler

$errorHandler

protected null|callable $errorHandler

$exception

protected null|Throwable $exception

$finalRequest

protected ServerRequestInterface $finalRequest

$middlewareFilter

protected array<string|int, mixed> $middlewareFilter

$psrContainer

protected Container $psrContainer

$request

protected ServerRequestInterface $request

$response

protected ResponseInterface $response

Methods

__construct()

App constructor.

public __construct(ServerRequestInterface $request, Bindings|null $containerBindings) : mixed
Parameters
$request : ServerRequestInterface
$containerBindings : Bindings|null
Return values
mixed

add()

Add middleware to the application via MiddlewareRegistry.

public add(callable|MiddlewareInterface $middleware[, string $key = '' ]) : static
Parameters
$middleware : callable|MiddlewareInterface
$key : string = ''
Return values
static

filter()

Filter middlewares.

public filter(array<string|int, mixed> $middlewareFilter) : void
Parameters
$middlewareFilter : array<string|int, mixed>
Return values
void

getContainer()

public getContainer() : Container
Return values
Container

handle()

The PSR-15 compliant method to handle a request.

public handle(ServerRequestInterface $request) : ResponseInterface
Parameters
$request : ServerRequestInterface
Return values
ResponseInterface

registerService()

Add a binding to the container.

public registerService(string $key, callable $binding) : Container
Parameters
$key : string
$binding : callable
Return values
Container

run()

public run() : void
Return values
void

setDefaultHandler()

Set the default handler that processes the final request if no other middleware modifies it.

public setDefaultHandler(callable $defaultHandler) : static
Parameters
$defaultHandler : callable
Return values
static

setErrorHandler()

Set the error handler middleware.

public setErrorHandler(callable $errorHandler) : static
Parameters
$errorHandler : callable
Return values
static

emitResponse()

protected emitResponse(ResponseInterface $response) : void
Parameters
$response : ResponseInterface
Return values
void

handleException()

Method to handle exceptions using the defined error handler.

protected handleException(Throwable $except, ServerRequestInterface $request) : ResponseInterface
Parameters
$except : Throwable
$request : ServerRequestInterface
Return values
ResponseInterface

terminateWithException()

Handles exception termination with context.

protected terminateWithException(Throwable $exception, ResponseInterface $response) : void
Parameters
$exception : Throwable
$response : ResponseInterface
Return values
void

withMiddleware()

Add middleware to the application via MiddlewareRegistry.

protected withMiddleware(callable|MiddlewareInterface $middleware[, string $key = '' ]) : static
Parameters
$middleware : callable|MiddlewareInterface
$key : string = ''
Return values
static

httpException()

Handles exceptions and ensures they are converted to an HTTP exception if necessary.

private httpException(Throwable $ex) : Throwable

This method checks the status code of the given exception and returns it directly if the code is within the valid HTTP status code range (100-599). Otherwise, it creates and returns a new HttpException with the message from the original exception.

Parameters
$ex : Throwable

The exception to process.

Return values
Throwable

An instance of the original exception if valid, or a new HttpException otherwise.

Search results