slimphp/Slim · error · RuntimeException

The Slim-Http ServerRequest decorator is not available.

Error message

The Slim-Http ServerRequest decorator is not available.

What it means

Error "The Slim-Http ServerRequest decorator is not available." thrown in slimphp/Slim.

Source

Thrown at Slim/Factory/Psr17/SlimHttpServerRequestCreator.php:36

class SlimHttpServerRequestCreator implements ServerRequestCreatorInterface
{
    protected ServerRequestCreatorInterface $serverRequestCreator;

    protected static string $serverRequestDecoratorClass = 'Slim\Http\ServerRequest';

    public function __construct(ServerRequestCreatorInterface $serverRequestCreator)
    {
        $this->serverRequestCreator = $serverRequestCreator;
    }

    /**
     * {@inheritdoc}
     */
    public function createServerRequestFromGlobals(): ServerRequestInterface
    {
        if (!static::isServerRequestDecoratorAvailable()) {
            throw new RuntimeException('The Slim-Http ServerRequest decorator is not available.');
        }

        $request = $this->serverRequestCreator->createServerRequestFromGlobals();

        if (
            !((
                $decoratedServerRequest = new static::$serverRequestDecoratorClass($request)
                ) instanceof ServerRequestInterface)
        ) {
            throw new RuntimeException(get_called_class() . ' could not instantiate a decorated server request.');
        }

        return $decoratedServerRequest;
    }

    public static function isServerRequestDecoratorAvailable(): bool
    {
        return class_exists(static::$serverRequestDecoratorClass);

View on GitHub (pinned to 80900fb39c)

When it happens

Trigger: Thrown at Slim/Factory/Psr17/SlimHttpServerRequestCreator.php:36 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of slimphp/Slim@80900fb39c (2026-08-21). Data as JSON: /api/errors/803864e4b8d4d41c. Report an issue: GitHub.