2017 © Pedro Peláez
 

library container-bridge-slim

Convenience bridge for using ronanchilvers/container with slim3

image

ronanchilvers/container-bridge-slim

Convenience bridge for using ronanchilvers/container with slim3

  • Thursday, March 15, 2018
  • by ronanchilvers
  • Repository
  • 1 Watchers
  • 0 Stars
  • 31 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 3 % Grown

The README.md

container-bridge-slim

Build Status codecov Software License, (*1)

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

Installation

The easiest way to install is via composer:, (*3)

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:, (*4)

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:, (*5)

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:, (*6)

./vendor/bin/phpunit

The default phpunit.xml.dist file creates coverage information in a build/coverage subdirectory., (*7)

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:, (*8)

  • 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., (*9)

The Versions

15/03 2018

dev-master

9999999-dev

Convenience bridge for using ronanchilvers/container with slim3

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ronan Chilvers

07/03 2018

1.1

1.1.0.0

Convenience bridge for using ronanchilvers/container with slim3

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ronan Chilvers

07/03 2018

1.0

1.0.0.0

Convenience bridge for using ronanchilvers/container with slim3

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ronan Chilvers