erison-work/slim-bump-showcase 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

erison-work/slim-bump-showcase

最新稳定版本:0.1.0

Composer 安装命令:

composer require erison-work/slim-bump-showcase

包简介

It's a helper to support you bump slim versions

README 文档

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

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-12