germania-kg/psrcontainerfactory

Factory callable that creates and returns a Pimple PSR-11 Container

1.1.3 2022-05-30 13:41 UTC

README

Packagist PHP version Build Status Scrutinizer Code Quality Code Coverage Build Status

Installation with Composer

$ composer require germania-kg/psrcontainerfactory

The PsrContainerFactory works with both Pimple DIC or PHP-DI. One of these must be installed. – N.B. that Pimple has aged and PHP-DI has evolved becoming kind of the DI library standard.

$ composer require php-di/php-di
$ composer require pimple/pimple

Usage

The callable accepts arrays, StdClass objects and other instances of ContainerInterface.

<?php
use Germania\PsrContainerFactory\PsrContainerFactory;
use Psr\Container\ContainerInterface;

$psr11 = (new PsrContainerFactory)([
	'foo' => 'bar'
]);
// yay!
echo ($psr_11 instanceOf ContainerInterface) ? "yay!" : "noe?";

Issues

See full issues list.

Roadmap

Fill in planned or desired features

Development

$ git clone https://github.com/GermaniaKG/psrcontainerfactory.git
$ cd psrcontainerfactory
$ composer install

Unit tests

Either copy phpunit.xml.dist to phpunit.xml and adapt to your needs, or leave as is. Run PhpUnit test or composer scripts like this:

$ composer test
# or
$ vendor/bin/phpunit