{"id":15524040,"url":"https://github.com/elazar/auryn-container-interop","last_synced_at":"2025-04-23T07:23:36.971Z","repository":{"id":56976261,"uuid":"61958990","full_name":"elazar/auryn-container-interop","owner":"elazar","description":"container-interop compatibility for Auryn","archived":false,"fork":false,"pushed_at":"2018-07-01T14:40:23.000Z","size":11,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T22:41:17.327Z","etag":null,"topics":["auryn","container-interop","dependency-injection","php","psr-11"],"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/elazar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-25T19:46:49.000Z","updated_at":"2023-12-09T11:11:06.000Z","dependencies_parsed_at":"2022-08-21T08:10:34.568Z","dependency_job_id":null,"html_url":"https://github.com/elazar/auryn-container-interop","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elazar%2Fauryn-container-interop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elazar%2Fauryn-container-interop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elazar%2Fauryn-container-interop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elazar%2Fauryn-container-interop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elazar","download_url":"https://codeload.github.com/elazar/auryn-container-interop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250388239,"owners_count":21422292,"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":["auryn","container-interop","dependency-injection","php","psr-11"],"created_at":"2024-10-02T10:48:53.455Z","updated_at":"2025-04-23T07:23:36.949Z","avatar_url":"https://github.com/elazar.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# auryn-container-interop\n\n[![Build Status](https://travis-ci.org/elazar/auryn-container-interop.svg?branch=master)](https://travis-ci.org/elazar/auryn-container-interop)\n\n[PSR-11](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-11-container.md) compatibility for [Auryn](https://github.com/rdlowrey/Auryn)\n\n## License\n\nThis library is licensed under the [MIT License](https://opensource.org/licenses/MIT).\n\n## Installation\n\nUse [composer](https://getcomposer.org/).\n\n```\ncomposer require elazar/auryn-container-interop\n```\n\n## Usage\n\n```php\nuse Elazar\\Auryn\\Container;\nuse Acme\\SomeDependency;\n\n$container = new Container;\n\nif ($container-\u003ehas(SomeDependency::class)) {\n    // ...\n}\n\n$instance = $container-\u003eget(SomeDependency::class);\n\n// All public methods of Auryn\\Injector are available\n$instance = $container-\u003emake(SomeDependency::class);\n```\n\nBe sure you are familiar with [how Auryn works](https://github.com/rdlowrey/Auryn#how-it-works).\nAs recommended by its author, avoid using it as a [service locator](https://en.wikipedia.org/wiki/Service_locator_pattern).\n\n## Implementation\n\nWhile I agree with a lot of the discussion in [this issue](https://github.com/rdlowrey/Auryn/issues/77)\nregarding why new projects can use Auryn directly without a *PSR-11*\nimplementation, I do think that such an implementation can be useful for\nintegrating Auryn with third-party libraries that use *PSR-11*, such\nas [zend-expressive](https://github.com/zendframework/zend-expressive).\n\nThe implementation in this repository takes a small amount of liberty with this\npassage from [Section 1.1.2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-11-container.md#112-reading-from-a-container)\nof the *PSR-11* specification:\n\n\u003e `has` ... MUST return `true` if an entry identifier is known to the container\n\nAuryn uses [fully qualified names](https://en.wikipedia.org/wiki/Fully_qualified_name)\nfor classes and interfaces to identify dependencies where most container\nimplementations use user-designated names. As such, it's possible for Auryn to\ninstantiate a class even if it contains no definitions for that class (e.g.\nif the class has no required constructor parameters or if those parameters are\nthemselves instantiable classes).\n\nBecause of this, `ContainerInterface-\u003ehas()` in this *PSR-11*\nimplementation will return `true` if either the underlying `Auryn\\Injector`\ninstance has definitions for a requested class or interface or if a requested\nclass is defined and considered instantiable (i.e. is not `abstract` and has a\n`public` implementation of `__construct()`). While some may view this as\ntechnically incorrect, it seems consistent to me with the overall spirit and\nintentions of the *PSR-11* standard.\n\n## Development\n\nTo run the PHPUnit test suite:\n\n```\ncomposer run-script test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felazar%2Fauryn-container-interop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felazar%2Fauryn-container-interop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felazar%2Fauryn-container-interop/lists"}