{"id":17114895,"url":"https://github.com/bartfeenstra/dependency-retriever","last_synced_at":"2026-06-11T09:30:19.376Z","repository":{"id":62491876,"uuid":"53253101","full_name":"bartfeenstra/dependency-retriever","owner":"bartfeenstra","description":null,"archived":true,"fork":false,"pushed_at":"2016-03-25T08:29:23.000Z","size":23,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-19T16:50:37.984Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bartfeenstra.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-06T12:12:00.000Z","updated_at":"2024-12-04T10:28:18.000Z","dependencies_parsed_at":"2022-11-02T11:16:19.479Z","dependency_job_id":null,"html_url":"https://github.com/bartfeenstra/dependency-retriever","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartfeenstra%2Fdependency-retriever","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartfeenstra%2Fdependency-retriever/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartfeenstra%2Fdependency-retriever/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartfeenstra%2Fdependency-retriever/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bartfeenstra","download_url":"https://codeload.github.com/bartfeenstra/dependency-retriever/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240226395,"owners_count":19768069,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T17:20:47.909Z","updated_at":"2026-06-11T09:30:19.343Z","avatar_url":"https://github.com/bartfeenstra.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dependency Retriever (woof!)\n\n[![Build Status](https://travis-ci.org/bartfeenstra/dependency-retriever.svg?branch=master)](https://travis-ci.org/bartfeenstra/dependency-retriever)\n\nThis package is a tool to make\n[dependency injection](https://en.wikipedia.org/wiki/Dependency_injection) and \nclass instantiation easier. Its API allows class' dependencies to be discovered \nand injected automatically by the factory.\n\nRetrievers help you inject dependencies, even if you can't or won't from the \ncalling code, by retrieving them based on suggestions from the class authors:\n\n```php\nuse Psr\\Log\\LoggerInterface;\n\nclass Bar {\n\n  /**\n   * @suggestedDependency drupalContainerService:logger.channel.form $formLogger\n   */\n  public function __construct(LoggerInterface $formLogger, $severity) {\n    // ...\n  }\n\n}\n```\n\nWhen used in a system in which Drupal's service container is available, the \n`logger.channel.form` service is a suggested dependency for the `$formLogger` \nparameter. The `drupalContainerService` retriever can retrieve this dependency \nand give it to the factory to be injected during class instantiation.\n\n```php\n$factory = new SimpleFactory(new AnnotatedFinder(), new DrupalContainerServiceRetriever());\n$bar = $factory-\u003einstantiate(Bar::class, [\n  'severity' =\u003e LogLevel::WARNING,\n]);\n```\nIn this example, `Bar` is instantiated using an overridden dependency (value) for `$severity`, but `AnnotatedFinder`, \nand the hypothetical `DrupalContainerServiceRetriever` provide the factory with a dependency for `$formLogger` based on \n`Bar`'s `@suggestedDependency` annotation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbartfeenstra%2Fdependency-retriever","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbartfeenstra%2Fdependency-retriever","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbartfeenstra%2Fdependency-retriever/lists"}