erison-work/slim-bump-showcase

It's a helper to support you bump slim versions

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/erison-work/slim-bump-showcase

0.1.0 2025-12-12 13:59 UTC

This package is auto-updated.

Last update: 2025-12-12 16:21:56 UTC


README

During the migration process, you may wish to make minor changes to your code base and revert them if necessary.

The aim of this project is to show you how you could make Slim 2 compatible with Slim 3.

I have made minor modifications to return PSR7 responses to Slim actions.

Tip

If you are in the process of migrating and require a version with full support for requests and responses like slim 3, contact me at slim@erison.work.

Tip

I tried to detail more in this article.

Caution

You SHOULD NOT use this package in production.

It isn't full implemented, in this repository you could have an idea how you could make your Slim 2 compatible with Slim 3

composer require erison-work/slim-bump-showcase

Changing you action it will be compatible with slim 2 and 3.

<?php

require dirname(__DIR__).'/vendor/autoload.php';

- use Slim\Slim;
+ use ErisonWork\SlimBumpShowcase\App;

- $app = new Slim();
+ $app = new App();

//It works on slim 2/3
$app->get('/', function () {
-   echo "Hello index";
+  $response = new GuzzleHttp\Psr7\Response();
+
+    $response->getBody()->write(sprintf('Hello Slim %s ', App::VERSION));
+
+   return $response;
});

//It will return not found on slim 3
$app->get('/hello/:name', function ($name) {
    echo "Hello, $name";
});

$app->run();

Bump to slim 3

composer require slim/slim:^3.0