定制 akrabat/rka-slim-zfsm-container 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

akrabat/rka-slim-zfsm-container

最新稳定版本:2.0.0

Composer 安装命令:

composer require akrabat/rka-slim-zfsm-container

包简介

Integration of ZF's ServiceManager into Slim 3

README 文档

README

This component enables you to replace the default Pimple container in Slim 3 with Zend\ServiceManager.

Usage

  • composer require akrabat/rka-slim-zfsm-container

  • update index.php:

    $settings = [
        'settings' => [
            // user settings go here
        ],
        'factories' => [
            // new SM factories go here
        ],
        // you can use any other SM key here too.
    ];
    $container = new RKA\ZsmSlimContainer\Container($settings);
    $app = new \Slim\App($container);

There is also an example application.

Overriding Slim's defaults

To override the default Slim handlers (e.g. errorHandler, notFound, etc), you can add them to the relevant section of $settings before instantiating the container:

$settings = [
    'factories' => [
        'errorHandler' => function ($container) {
            // do your own thing here
        },
    ],
];
$container = new RKA\ZsmSlimContainer\Container($settings);
$app = new \Slim\App($container);

Alternatively you can also override afterwards if you want to:

$container->setAllowOverride(true);
$container['errorHandler'] = function($container) {
	// set-up error handler
};

统计信息

  • 总下载量: 8.9k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 4
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2015-07-04