geggleto/slim-pimple-bridge

Slim Pimple Bridge. 将 slim 的依赖注入到 Pimple 容器中

0.1.1 2015-12-03 13:01 UTC

This package is auto-updated.

Last update: 2024-08-29 04:25:24 UTC


README

Slim-Pimple Bridge 允许您将现有的 Pimple 3.x 容器带到 Slim 3.x 应用程序中,而无需您重构现有容器。

安装

composer require geggleto/slim-pimple-bridge

使用方法

以下示例假设您的 Pimple\Container 实例被分配给了 $myAwesomePimpleContainer 变量。

// Here's a default \Slim\Container.
$slimContainer = new \Slim\Container();

// Use SlimPimpleBridge::merge() to add all of the services from your container
// to the $slimContainer instance.
$container = SlimPimpleBridge::merge(
    $slimContainer,
    $myAwesomePimpleContainer
);

// Done! It's that easy!
$app = new \Slim\App($container);