Slim and StrataPHP are 90% identical. StrataPHP just adds structure + modules.
use Slim\Factory\AppFactory;
$app = AppFactory::create();
$app->get('/hello/{name}', function ($req, $res, $args) {
return $res->write("Hello {$args['name']}");
});
$app->run();
use StrataPHP\App;
$app = new App();
$router = $app->getRouter();
$router->get('/hello/{name}', function ($req) {
return new Response("Hello {$req->getAttribute('name')}");
});
$app->run();
Change: `AppFactory::create()` → `new App()`. Responses are explicit PSR-7.
Slim 4 middleware is PSR-15. Copy it directly.
// This Slim middleware works in StrataPHP unchanged
$app->add(function ($request, $handler) {
$response = $handler->handle($request);
return $response->withHeader('X-Powered-By', 'StrataPHP');
});
Both use PSR-11. If you used PHP-DI with Slim, keep using it.
composer require php-di/php-di
$container = new Container();
$app = new App($container);
Time estimate: 2-4 hours for a typical Slim API.
Slim stays micro forever. If you need admin, CMS, or user management, you'll build it yourself. StrataPHP gives you official modules for that. Same speed, more tools.