diff --git a/README.md b/README.md index 67180ed..65782ad 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,63 @@ -# dependency-resolver -Dependency-resolver utility based on PSR-11 container to be used for auto-wiring +![Status][badge] + +# Technically Dependency Resolver + +`Technically\DependencyResolver` is a simple yet powerful tool to instantiate classes +autowiring their dependencies by resolving them from a [PSR-11][1] container +or recursively instantiating them with *DependencyResolver* itself. + +## Features + +- Based on PSR-11 +- PHP 8.0 ready (supports union type hints; see examples below) +- PHP 7.1+ compatible +- Recursive dependencies autowiring +- Semver +- Tests + +## Installation + +Use [Composer][2] package manager to add *Technically\DependencyResolver* to your project: + +``` +composer require technically/dependency-resolver +``` + +## Example + +```php +resolve(MyFancyService::class, [ + 'log' => function (string $priority, string $message) { + error_log("[$priority]: $message"); + }] +); + +// Resolve service instance, resolving dependencies from container: +$container->set(LoggerInterface::class, $logger); +$resolver = new DependencyResolver($container); +$service = $resolver->resolve(MyFancyService::class); + + +``` + +## Credits + +- Implemented by [Ivan Voskoboinyk][3] + + +[1]: https://www.php-fig.org/psr/psr-11/ +[2]: https://getcomposer.org/ +[3]: https://github.com/e1himself +[badge]: https://github.com/technically-php/array-container/actions/workflows/test.yml/badge.svg