Skip to content
Daniel Opitz edited this page Jul 18, 2024 · 26 revisions

Status: Draft / Planning

Slim 5 Issues: https://github.com/slimphp/Slim/issues?q=is%3Aissue+is%3Aopen+label%3A%22Slim+5%22

Planning

  • 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

Changes

  • Bring back the simplicity. Simplify App instantiation. The AppFactory should not be needed anymore.
  • Dependency Injection (DI): Improve DI container integration. Require a PSR-11 package.
  • Move ErrorMiddleware into a new package
  • Ensure that route attributes are always in the Request #3280
  • Unify CallableResolver and AdvancedCallableResolver #3073
  • Resolving middleware breaks if resolver throws unexpected exception type #3071
  • Forward logger to own ErrorHandlingMiddleware #2943

New Features

  • Optimize middleware execution pipeline: Provide FIFO middleware support
  • Provide integrated base path middleware
  • Provide CallbackStream.

Dependencies

  • 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

Documentation

  • 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

Remove

  • TBD

Testing

  • Require PHPUnit 11.
  • Optimize tests. Avoid mocking where possible.
  • Use Mockery for all new tests which require mocking. Drop prophecy?

Final Release

  • Release Candidate: Prepare and release the Slim 5 release candidate for final testing.
  • Official Release: Launch Slim 5 with complete documentation and migration guides.

Minimal Slim 5 Example

Installation:

composer require slim/slim:5.*
composer require slim/psr7
composer require php-di/php-di

File: public/index.php

<?php

use Slim\App;

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

// Create App without AppFactory
// This will create the DI container instance internally
$app = new App();

// Add Routing Middleware
// This will add the new EndpointRoutingMiddleware and the new EndpointMiddleware
$app->addRoutingMiddleware();

// Add Exception Middleware
// This will add the new ExceptionHandlerMiddleware
$app->addExceptionHandlerMiddleware();

// Register Routes
$app->get('/', function ($request, $response, $args) {});

// Run the app
$app->run();
Clone this wiki locally