{"action":"created","issue":{"url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/6594","repository_url":"https://api.github.com/repos/silverstripe/silverstripe-framework","labels_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/6594/labels{/name}","comments_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/6594/comments","events_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/6594/events","html_url":"https://github.com/silverstripe/silverstripe-framework/issues/6594","id":204789078,"number":6594,"title":"RFC: Make Injector comply with PSR-11","user":{"login":"sminnee","id":59968,"avatar_url":"https://avatars2.githubusercontent.com/u/59968?v=3","gravatar_id":"","url":"https://api.github.com/users/sminnee","html_url":"https://github.com/sminnee","followers_url":"https://api.github.com/users/sminnee/followers","following_url":"https://api.github.com/users/sminnee/following{/other_user}","gists_url":"https://api.github.com/users/sminnee/gists{/gist_id}","starred_url":"https://api.github.com/users/sminnee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sminnee/subscriptions","organizations_url":"https://api.github.com/users/sminnee/orgs","repos_url":"https://api.github.com/users/sminnee/repos","events_url":"https://api.github.com/users/sminnee/events{/privacy}","received_events_url":"https://api.github.com/users/sminnee/received_events","type":"User","site_admin":false},"labels":[{"id":386316041,"url":"https://api.github.com/repos/silverstripe/silverstripe-framework/labels/affects/v4","name":"affects/v4","color":"5319e7","default":false},{"id":86042174,"url":"https://api.github.com/repos/silverstripe/silverstripe-framework/labels/change/major","name":"change/major","color":"e99695","default":false},{"id":182941393,"url":"https://api.github.com/repos/silverstripe/silverstripe-framework/labels/effort/medium","name":"effort/medium","color":"fef2c0","default":false},{"id":182941354,"url":"https://api.github.com/repos/silverstripe/silverstripe-framework/labels/impact/high","name":"impact/high","color":"eb6420","default":false},{"id":257961652,"url":"https://api.github.com/repos/silverstripe/silverstripe-framework/labels/rfc/draft","name":"rfc/draft","color":"DDDDDD","default":false},{"id":34209120,"url":"https://api.github.com/repos/silverstripe/silverstripe-framework/labels/type/enhancement","name":"type/enhancement","color":"0e8a16","default":false}],"state":"open","locked":false,"assignee":{"login":"chillu","id":111025,"avatar_url":"https://avatars0.githubusercontent.com/u/111025?v=3","gravatar_id":"","url":"https://api.github.com/users/chillu","html_url":"https://github.com/chillu","followers_url":"https://api.github.com/users/chillu/followers","following_url":"https://api.github.com/users/chillu/following{/other_user}","gists_url":"https://api.github.com/users/chillu/gists{/gist_id}","starred_url":"https://api.github.com/users/chillu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chillu/subscriptions","organizations_url":"https://api.github.com/users/chillu/orgs","repos_url":"https://api.github.com/users/chillu/repos","events_url":"https://api.github.com/users/chillu/events{/privacy}","received_events_url":"https://api.github.com/users/chillu/received_events","type":"User","site_admin":false},"assignees":[{"login":"chillu","id":111025,"avatar_url":"https://avatars0.githubusercontent.com/u/111025?v=3","gravatar_id":"","url":"https://api.github.com/users/chillu","html_url":"https://github.com/chillu","followers_url":"https://api.github.com/users/chillu/followers","following_url":"https://api.github.com/users/chillu/following{/other_user}","gists_url":"https://api.github.com/users/chillu/gists{/gist_id}","starred_url":"https://api.github.com/users/chillu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chillu/subscriptions","organizations_url":"https://api.github.com/users/chillu/orgs","repos_url":"https://api.github.com/users/chillu/repos","events_url":"https://api.github.com/users/chillu/events{/privacy}","received_events_url":"https://api.github.com/users/chillu/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/silverstripe/silverstripe-framework/milestones/38","html_url":"https://github.com/silverstripe/silverstripe-framework/milestone/38","labels_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/milestones/38/labels","id":1858534,"number":38,"title":"Recipe 4.0.0-beta1","description":"Feature-complete release of SilverStripe 4.","creator":{"login":"sminnee","id":59968,"avatar_url":"https://avatars2.githubusercontent.com/u/59968?v=3","gravatar_id":"","url":"https://api.github.com/users/sminnee","html_url":"https://github.com/sminnee","followers_url":"https://api.github.com/users/sminnee/followers","following_url":"https://api.github.com/users/sminnee/following{/other_user}","gists_url":"https://api.github.com/users/sminnee/gists{/gist_id}","starred_url":"https://api.github.com/users/sminnee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sminnee/subscriptions","organizations_url":"https://api.github.com/users/sminnee/orgs","repos_url":"https://api.github.com/users/sminnee/repos","events_url":"https://api.github.com/users/sminnee/events{/privacy}","received_events_url":"https://api.github.com/users/sminnee/received_events","type":"User","site_admin":false},"open_issues":35,"closed_issues":37,"state":"open","created_at":"2016-06-30T22:49:57Z","updated_at":"2017-05-18T23:11:13Z","due_on":"2017-06-30T07:00:00Z","closed_at":null},"comments":0,"created_at":"2017-02-02T05:58:32Z","updated_at":"2017-05-18T23:11:55Z","closed_at":null,"body":"PSR-11 covers service containers for dependency injection; Injector is one of these.\r\n\r\nhttps://github.com/php-fig/fig-standards/blob/master/accepted/PSR-11-container.md\r\nhttps://packagist.org/packages/psr/container\r\n\r\nMy short-term proposal is that we update Injector to make use of this interface:\r\n\r\n * Replace `hasService()` with a boolean-returning `has()`.\r\n * Allow any `Psr\\Container\\ContainerInterface` to be passed to `Injector::set_inst()`\r\n\r\nMy long-term proposal is that we remove usage of the Injector that doesn't comply with this PSR:\r\n\r\n * Shift away from widespread use of `Injector::create()`, `Injector::createWithArgs()`, and `Injectable::create()`, instead favour factories that are provided by `Injector::get()`.\r\n\r\nThis isn't something that I would expect to see ready by SS4 but that perhaps by SS5 we can deprecate these methods.\r\n\r\nThe benefits of these changes are as follows:\r\n\r\n * `Injector` can be passed to other PSR-11-compliant frameworks to provide services. My short-term proposal allows for this.\r\n * Other PSR-11-complaint frameworks. My long-term proposal allows for this.\r\n\r\n## Alternatives\r\n\r\nAn alternative approach to `create()` and `createWithArgs()` would be to let developers supply both a PSR-11-compliant container and a \"Generic Factory\". `get()` would be routed to the container and `create()` / `createWithArgs()` would be routed to the generic factory.\r\n\r\nAs a tweak on this, GenericFactory could be shifted to being a service that the parent Injector provides.\r\n\r\n```php\r\nInjector::inst()->get('GenericFactory')->create('<class>');\r\n```\r\n\r\nThis would make it easier to make use of 3rd party service containers before the long-term factory has completed. However, it's a bit messier."},"comment":{"url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/comments/302565983","html_url":"https://github.com/silverstripe/silverstripe-framework/issues/6594#issuecomment-302565983","issue_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/6594","id":302565983,"user":{"login":"chillu","id":111025,"avatar_url":"https://avatars0.githubusercontent.com/u/111025?v=3","gravatar_id":"","url":"https://api.github.com/users/chillu","html_url":"https://github.com/chillu","followers_url":"https://api.github.com/users/chillu/followers","following_url":"https://api.github.com/users/chillu/following{/other_user}","gists_url":"https://api.github.com/users/chillu/gists{/gist_id}","starred_url":"https://api.github.com/users/chillu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chillu/subscriptions","organizations_url":"https://api.github.com/users/chillu/orgs","repos_url":"https://api.github.com/users/chillu/repos","events_url":"https://api.github.com/users/chillu/events{/privacy}","received_events_url":"https://api.github.com/users/chillu/received_events","type":"User","site_admin":false},"created_at":"2017-05-18T23:11:55Z","updated_at":"2017-05-18T23:11:55Z","body":"PR at https://github.com/silverstripe/silverstripe-framework/pull/6931"}}
{"actor":{"display_login":"chillu"}}