fast-forward / container
Fast Forward PSR-11 Container utility classes
v1.2.1
2025-05-06 17:25 UTC
Requires
- php: ^8.1
- container-interop/service-provider: ^0.4.1
- fast-forward/config: ^1.1
- php-di/php-di: ^7.0
- psr/container: ^1.0 || ^2.0
Requires (Dev)
- coisa/php-cs-fixer: ^2.1
- phpspec/prophecy-phpunit: ^2.3
- phpunit/phpunit: ^9.6 || ^10.5 || ^11.5
This package is auto-updated.
Last update: 2025-05-06 17:25:57 UTC
README
A PSR-11 compliant aggregate container for PHP, designed to unify and resolve services across multiple container implementations. Built to work seamlessly with php-di
, configuration objects, and custom container stacks.
✨ Features
- Aggregates multiple containers
- Caches resolved entries
- Integrates with
php-di
- First-class support for configuration containers
- PSR-11 compliant
🚀 Installation
composer require fast-forward/container
🛠️ Usage
use FastForward\Container\ContainerInterface; use FastForward\Container\container; use FastForward\Config\ArrayConfig; $config = new ArrayConfig([ ContainerInterface::class => [ SomeServiceProvider::class, // strings will be initialized with a new call SomePsr11Container::class, // strings should be initializable with a simple new call new OtherServiceProvider('withArgument'), // objects that implement Interop\Container\ServiceProviderInterface new ServiceManager($dependencies), // objects that implement Psr\Container\ContainerInterface ], ]); $container = container($config); // or using the container function directly with a configuration variadic // $container = container( // SomeServiceProvider::class, // SomePsr11Container::class, // new ApplicationConfig(), // that implements ConfigInterface with the ContainerInterface key // new OtherServiceProvider('withArgument'), // new ServiceManager($dependencies), // ); // Retrieve service $service = $container->get(SomeService::class);
📄 License
This package is licensed under the MIT License. See the LICENSE file for more details.