john-jun / container
A simple Container is implemented based on psr-11
1.0.0
2020-06-10 06:42 UTC
Requires
- php: ^7.1
- psr/container: ^1.0
Requires (Dev)
- ext-redis: *
- phpunit/phpunit: ^8.5
This package is auto-updated.
Last update: 2025-03-10 16:47:22 UTC
README
A simple Container is implemented based on psr-11
Install
To install with composer
composer require john-jun/container
Test
composer test
Usage
$container = new \Air\Container\Container(); $redis = new \Redis(); $container->singleton('obj', $redis); $container->singleton('redis', \Redis::class); $container->bind('name', function(\Redis $redis) { return $redis; }, true); $container->get('obj'); $container->make('redis'); $container->make('name'); $container->make('obj name more'); $container->has('obj'); $container->alias('objAlias', 'obj');