guanguans / di
A flexible dependency injection container based on the modification of `illuminate/container`. - 一个灵活的基于 `illuminate/container` 修改的依赖注入容器。
Fund package maintenance!
Wechat
Installs: 1 205
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.6.4
- psr/container: ^1.0
Requires (Dev)
- brainmaestro/composer-git-hooks: ^2.7
- friendsofphp/php-cs-fixer: ^2.16
- mockery/mockery: ^1.2
- phpunit/phpunit: ^7
- vimeo/psalm: ^3.11
This package is auto-updated.
Last update: 2024-12-16 16:04:56 UTC
README
A flexible dependency injection container based on the modification of
illuminate/container
. - 一个灵活的基于illuminate/container
修改的依赖注入容器。
Requirement
- PHP >= 5.6
Installation
$ composer require guanguans/di -vvv
Usage
<?php require __DIR__.'/vendor/autoload.php'; class ConcreteStub{} $container = new \Guanguans\Di\Container(); // Simple Bindings $container->bind(ConcreteStub::class, function ($container) { return new ConcreteStub(); }); // Binding A Singleton $container->singleton('ConcreteStub', function ($container) { return new ConcreteStub(); }); // Binding Interfaces To Implementations $container->bind( 'App\Contracts\EventPusher', 'App\Services\RedisEventPusher' ); // Resolving $concreteStub = $container->make(ConcreteStub::class);
Testing
$ composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.