Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

🔁 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

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.

Status

Features

  • 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

Installation

UseComposer package manager to addTechnically\DependencyResolver to your project:

composer require technically/dependency-resolver

Example

<?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);

Changelog

All notable changes to this project will be documented in theCHANGELOG file.

Credits

About

🔁 Dependency-resolver utility based on PSR-11 container to be used for auto-wiring. 🐘 PHP8-ready 🎉

Topics

Resources

License

Stars

Watchers

Forks


[8]ページ先頭

©2009-2025 Movatter.jp