Skip to content

Solo ApplicationPSR-15 Application Kernel

Wires your container, middleware and routes into one request handler, with routing by Solo Router 4.

Solo Application

Version 4.0.1 ​

Solo Application 4.0.1 requires PHP 8.3 or later. It creates the RouteCollector, calls your routes.php and builds the router with Solo Router 4, keeps it in a route cache if you ask it to, and throws routing errors instead of answering them with empty responses. Upgrading from 3.x? Read the upgrade guide.

4.0.0, published on 17 October 2026, is an earlier state of this release that still takes the router from the container: install 4.0.1 or later.

Quick Example ​

php
<?php
// public/index.php

use App\Providers\HttpServiceProvider;
use Solo\Application\Application;
use Solo\Application\Config;
use Solo\Application\RoutingErrorMiddleware;
use Solo\Application\RoutingMiddleware;

require __DIR__ . '/../vendor/autoload.php';

$app = new Application(new Config(
    basePath: dirname(__DIR__),
    routesPath: dirname(__DIR__) . '/app/routes.php',
    providers: [HttpServiceProvider::class],
    middleware: [RoutingErrorMiddleware::class, RoutingMiddleware::class],
));

$app->run();
php
<?php
// app/routes.php

use App\Controller\UserController;
use Solo\Router\RouteCollector;

return function (RouteCollector $r): void {
    $r->get('/users/{id}', [UserController::class, 'show'])->name('users.show');
};

The controller comes from the container and gets the request, a new response and the route parameters:

php
<?php

namespace App\Controller;

use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;

final class UserController
{
    public function show(ServerRequestInterface $request, ResponseInterface $response, array $params): ResponseInterface
    {
        $response->getBody()->write("User {$params['id']}");

        return $response;
    }
}

HttpServiceProvider registers the PSR-17 factory, the incoming request and the emitter: see the quick start.

bash
composer require "solophp/application:^4.0.1"

Requirements: PHP 8.3 or later, a PSR-7/PSR-17 implementation, a container and an HTTP emitter. See installation.

Get started · Lifecycle · API reference · Upgrade guide

Released under the MIT License.