定制 ronanchilvers/container-bridge-slim 二次开发

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

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

ronanchilvers/container-bridge-slim

Composer 安装命令:

composer require ronanchilvers/container-bridge-slim

包简介

Convenience bridge for using ronanchilvers/container with slim3

README 文档

README

Build Status codecov Software License

A bridge for using ronanchilvers/container with Slim3. This package allows you to replace the default slim3 container (Pimple) with ronanchilvers/container.

Installation

The easiest way to install is via composer:

composer install ronanchilvers/container-bridge-slim

Usage

To replace the default slim container with ronanchilvers/container all you need to do is pass an instance of the container into the constructor of the slim app object. Here's an example:

use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Ronanchilvers\Container\Slim\Container;
use Slim\App;

// Initialise a new container instance
$container = new Container();

// Pass the container instance into the app object's constructor
$app = new App($container);

$app->get('/', function (ServerRequestInterface $request, ResponseInterface $response) {
    return $response->write('hallo');
});
$app->run();

Controlling Slim settings is similar to the usual Slim mechanism:

use Ronanchilvers\Container\Slim\Container;
use Slim\App;

$container = new Container([
    'settings' => [
        'displayErrorDetails' => true,
    ]
]);

// Create the App object
$app = new App($container);

Testing

This is quite simple a simple bridge and has 100% test coverage. You can run the tests by doing:

./vendor/bin/phpunit

The default phpunit.xml.dist file creates coverage information in a build/coverage subdirectory.

Contributing

If anyone has any patches they want to contribute I'd be more than happy to review them. Please raise a PR. You should:

  • Follow PSR2
  • Maintain 100% test coverage or give the reasons why you aren't
  • Follow a one feature per pull request rule

License

This software is licensed under the MIT license. Please see the License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-03-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固