2017 © Pedro Peláez
 

library slimbox

Slim Framework with Unbox container

image

geekish/slimbox

Slim Framework with Unbox container

  • Monday, July 24, 2017
  • by hannahwarmbier
  • Repository
  • 1 Watchers
  • 4 Stars
  • 79 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Slimbox

Latest Version on Packagist ![Software License][ico-license] Build Status Coverage Status ![Quality Score][ico-code-quality] Total Downloads, (*1)

Bringing mindplay/unbox into Slim Framework., (*2)

Install

Via Composer:, (*3)

``` bash composer require geekish/slimbox, (*4)


## Usage ### Service Provider The most important class in this package is `Geekish\Slimbox\DefaultServicesProvider`. It ensures the same services [required by Slim](https://www.slimframework.com/docs/concepts/di.html#required-services) are available through Unbox. Besides the change in container, it differs from `Slim\DefaultServicesProvider` by registering services under their FQCN first, then registers aliases by their interfaces, and finally the short aliases used by slim (e.g. "router", "foundHandler"). Registering services by their class name enables Unbox to automatically inject them as dependencies as needed by other classes. The service provider is _not_ automatically registered for you, so you need to do this yourself: ```php use Geekish\Slimbox\DefaultServicesProvider; use mindplay\unbox\ContainerFactory; $factory = new ContainerFactory; $factory->add(new DefaultServicesProvider); $container = $factory->createContainer();

Settings

Also included is Geekish\Slimbox\Settings, which extends from Slim\Collection. This class replaces the simple array that Slim registers under "settings" (see: Slim Default Settings)., (*5)

Settings may be provided via the constructor of the DefaultServicesProvider:, (*6)

$factory->add(new DefaultServicesProvider([
    "outputBuffering" => "prepend",
]));

Or via the configure() method on ContainerFactory:, (*7)

$factory->configure(
    Settings::class,
    function (Settings $settings) {
        $settings['displayErrorDetails'] = true;
        return $settings;
    }
);

Container and Container Factory (Optional)

This package contains an extended (final) Container and ContainerFactory from Unbox. Usage is almost exactly the same as using Unbox directly, except the extended Container partially implements ArrayAccess. This allows you to use the Container like an array to access services; however, due to the fact that Unbox uses a factory class to create the container, you cannot use array notation to set/configure services on the Container., (*8)

To use the extended ContainerFactory:, (*9)

``` php use Geekish\Slimbox\ContainerFactory; use Geekish\Slimbox\DefaultServicesProvider; use Slim\App;, (*10)

$factory = new ContainerFactory; $factory->add(new DefaultServicesProvider([ "outputBuffering" => "prepend", ]));, (*11)

$container = $factory->createContainer();, (*12)


Usage of the packaged `Container` and `ContainerFactory` is entirely optional; they are included purely for convenience and consistency with Slim's packaged `Container`. Simply replace `Geekish\Slimbox\ContainerFactory` in the snippet above with `mindplay\unbox\ContainerFactory`. ## Change log Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. ## Testing ``` bash $ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details., (*13)

Security

If you discover any security related issues, please email hannahwarmbier@gmail.com instead of using the issue tracker., (*14)

Credits

License

The MIT License (MIT). Please see License File for more information., (*15)

The Versions

24/07 2017

dev-develop

dev-develop https://github.com/geekish/slimbox

Slim Framework with Unbox container

  Sources   Download

MIT

The Requires

 

The Development Requires

slim slim framework unbox

17/05 2017

dev-master

9999999-dev https://github.com/geekish/slimbox

Slim Framework with Unbox container

  Sources   Download

MIT

The Requires

 

The Development Requires

geekish slimbox

01/12 2016

0.3.0

0.3.0.0 https://github.com/geekish/slimbox

Slim Framework with Unbox container

  Sources   Download

MIT

The Requires

 

The Development Requires

geekish slimbox

14/11 2016

0.2.0

0.2.0.0 https://github.com/geekish/slimbox

Slim Framework with Unbox container

  Sources   Download

MIT

The Requires

 

The Development Requires

geekish slimbox

12/11 2016

0.1.0

0.1.0.0 https://github.com/geekish/slimbox

Slim Framework with Unbox container

  Sources   Download

MIT

The Requires

 

The Development Requires

geekish slimbox