{"action":"created","issue":{"url":"https://api.github.com/repos/rdlowrey/auryn/issues/130","labels_url":"https://api.github.com/repos/rdlowrey/auryn/issues/130/labels{/name}","comments_url":"https://api.github.com/repos/rdlowrey/auryn/issues/130/comments","events_url":"https://api.github.com/repos/rdlowrey/auryn/issues/130/events","html_url":"https://github.com/rdlowrey/auryn/issues/130","id":118283768,"number":130,"title":"[question] multiple shared instances of a class / multiple implementations of an interface","user":{"login":"mdecaffmeyer","id":5883963,"avatar_url":"https://avatars.githubusercontent.com/u/5883963?v=3","gravatar_id":"","url":"https://api.github.com/users/mdecaffmeyer","html_url":"https://github.com/mdecaffmeyer","followers_url":"https://api.github.com/users/mdecaffmeyer/followers","following_url":"https://api.github.com/users/mdecaffmeyer/following{/other_user}","gists_url":"https://api.github.com/users/mdecaffmeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/mdecaffmeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdecaffmeyer/subscriptions","organizations_url":"https://api.github.com/users/mdecaffmeyer/orgs","repos_url":"https://api.github.com/users/mdecaffmeyer/repos","events_url":"https://api.github.com/users/mdecaffmeyer/events{/privacy}","received_events_url":"https://api.github.com/users/mdecaffmeyer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-11-22T19:37:49Z","updated_at":"2015-11-23T07:00:28Z","closed_at":null,"body":"How do you handle the cases where for example I have two shared PDO objects, with different configuration?\r\nE.g. I'd have two databases and some classes need one instance and other classes would need the other one?\r\nSeems like ```$injector->share('PDO');``` allows me to share only a single PDO instance.\r\n\r\nIn the same way, how do you handle interfaces with multiple implementations, where some classes need one of the implementation and other classes other implementations? Aliases seem to restrict to link an interface to a single concrete implementation class.\r\n```$injector->alias('Engine', 'V8');``` How about other classes that have an Engine dependency and I want to inject V6?"},"comment":{"url":"https://api.github.com/repos/rdlowrey/auryn/issues/comments/158864588","html_url":"https://github.com/rdlowrey/auryn/issues/130#issuecomment-158864588","issue_url":"https://api.github.com/repos/rdlowrey/auryn/issues/130","id":158864588,"user":{"login":"vlakarados","id":386678,"avatar_url":"https://avatars.githubusercontent.com/u/386678?v=3","gravatar_id":"","url":"https://api.github.com/users/vlakarados","html_url":"https://github.com/vlakarados","followers_url":"https://api.github.com/users/vlakarados/followers","following_url":"https://api.github.com/users/vlakarados/following{/other_user}","gists_url":"https://api.github.com/users/vlakarados/gists{/gist_id}","starred_url":"https://api.github.com/users/vlakarados/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vlakarados/subscriptions","organizations_url":"https://api.github.com/users/vlakarados/orgs","repos_url":"https://api.github.com/users/vlakarados/repos","events_url":"https://api.github.com/users/vlakarados/events{/privacy}","received_events_url":"https://api.github.com/users/vlakarados/received_events","type":"User","site_admin":false},"created_at":"2015-11-23T07:00:28Z","updated_at":"2015-11-23T07:00:28Z","body":"@mdecaffmeyer I think [this is something similar to what you're after](https://github.com/rdlowrey/auryn#defining-class-names-for-constructor-parameters). Define which implementation for which class you want. But honestly, I don't think it's the best way to achieve what you want. I'd stay with method from my first comment or used factories like @morrisonlevi mentioned."}}