- Notifications
You must be signed in to change notification settings - Fork0
🔁 Dependency-resolver utility based on PSR-11 container to be used for auto-wiring. 🐘 PHP8-ready 🎉
License
NotificationsYou must be signed in to change notification settings
technically-php/dependency-resolver
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Technically\DependencyResolver is a simple yet powerful tool to instantiate classesautowiring their dependencies by resolving them from aPSR-11 containeror recursively instantiating them withDependencyResolver itself.
- Based on PSR-11
- Supports modern PHP 8 features (up to PHP 8.4) — full support of union type hints, and others.
- Recursive dependencies autowiring
- Semver
- Tests
UseComposer package manager to addTechnically\DependencyResolver to your project:
composer require technically/dependency-resolver<?phpfinalclass MyFancyService {publicfunction__construct(callable|LoggerInterface$log) {// initialize }}// Construct a service instance, providing dependencies in-place:$resolver =newDependencyResolver();$service =$resolver->construct(MyFancyService::class, ['log' =>function (string$priority,string$message) {error_log("[$priority]:$message"); }]);// Resolve service instance from container, falling back to `construct()` otherwise.$resolver =newDependencyResolver($container);$service =$resolver->resolve(MyFancyService::class);
All notable changes to this project will be documented in theCHANGELOG file.
- Implemented by 👾Ivan Voskoboinyk
- Heavily inspired by Dawid Kraczkowski's work inigniphp/container
About
🔁 Dependency-resolver utility based on PSR-11 container to be used for auto-wiring. 🐘 PHP8-ready 🎉
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.