-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Slim 5 Road Map
Daniel Opitz edited this page Jan 2, 2025
·
28 revisions
Status: In progress
Current working branch: https://github.com/slimphp/Slim/tree/5.x
Changelog: https://github.com/slimphp/Slim/blob/5.x/CHANGELOG.md
Slim 5 Issues: https://github.com/slimphp/Slim/issues?q=is%3Aissue+is%3Aopen+label%3A%22Slim+5%22
- Collect feedback from the Slim community to identify pain points and desired features.
- Identify how new PHP 8 features can be integrated to enhance Slim 5
- Bring back the simplicity. Simplify App instantiation.
- Improve DI container integration. Make the DI container a first-class citizen. Require a PSR-11 package.
- Ensure that route attributes are always in the Request #3280. See new
RoutingArgumentsMiddleware
. - Unify
CallableResolver
andAdvancedCallableResolver
#3073. Resolved with the new CallableResolver. - Resolving middleware breaks if resolver throws unexpected exception type #3071. Resolved with the new CallableResolver.
- Forward logger to own
ErrorHandlingMiddleware
#2943. See newExceptionLoggingMiddleware
.
- Add new
RoutingMiddleware
and the newEndpointMiddleware
. - Optimize middleware execution pipeline: Provide (only) FIFO middleware support.
- Provide integrated base path middleware. See new
BasePathMiddleware
. - Provide support for other routing packages. The
RoutingMiddleware
and/orEndpointMiddleware
can be replaced with custom middleware implementations. - Provide support for custom error handlers using a new interface (
ExceptionHandlerInterface
). See newExceptionHandlingMiddleware
. - Provide support for custom error logging. See new
ExceptionLoggingMiddleware
.
- Require >= PHP 8.2
- PSR-7 and PSR-15 compliance: Require at least psr/http-message 2.0.
- PSR-11 compliance: Require at least psr/container 2.0.
- PSR-3 compliance: Require at least psr/log 3.0
- Update changelog
- Update and expand the official documentation to cover new features and best practices.
- Provide updated tutorials and example applications to help developers get started with Slim 5.
- Add migration guide
- ErrorMiddleware. Replaced by ExceptionHandlingMiddleware and ExceptionLoggingMiddleware.
- Require PHPUnit 11.
- Optimize tests. Avoid mocking wherever possible. Drop prophecy.
- Release Candidate: Prepare and release the Slim 5 release candidate for final testing.
- Official Release: Launch Slim 5 with complete documentation and migration guides.
Installation:
composer require slim/slim:5.*
composer require slim/psr7
composer require php-di/php-di
File: public/index.php
<?php
use Slim\Builder\AppBuilder;
use Slim\Middleware\BodyParsingMiddleware;
use Slim\Middleware\EndpointMiddleware;
use Slim\Middleware\ExceptionHandlingMiddleware;
use Slim\Middleware\ExceptionLoggingMiddleware;
use Slim\Middleware\RoutingMiddleware;
require __DIR__ . '/../vendor/autoload.php';
// Build the App instance
$builder = new AppBuilder();
$app = $builder->build();
// Add middleware (New: FIFO by default)
$app->add(RoutingMiddleware::class);
$app->add(BodyParsingMiddleware::class);
$app->add(ExceptionHandlingMiddleware::class);
$app->add(ExceptionLoggingMiddleware::class);
$app->add(EndpointMiddleware::class);
// Register Routes
$app->get('/', function ($request, $response, $args) {
$response->getBody()->write("Hello, World!");
return $response;
});
// Register route with action class
$app->get('/ping', \App\Action\PingAction::class);
// Run the app
$app->run();