{"action":"opened","issue":{"url":"https://api.github.com/repos/mnapoli/PHP-DI/issues/239","labels_url":"https://api.github.com/repos/mnapoli/PHP-DI/issues/239/labels{/name}","comments_url":"https://api.github.com/repos/mnapoli/PHP-DI/issues/239/comments","events_url":"https://api.github.com/repos/mnapoli/PHP-DI/issues/239/events","html_url":"https://github.com/mnapoli/PHP-DI/issues/239","id":63387382,"number":239,"title":"Container::call() should allow to define dependencies a la AngularJS","user":{"login":"mnapoli","id":720328,"avatar_url":"https://avatars.githubusercontent.com/u/720328?v=3","gravatar_id":"","url":"https://api.github.com/users/mnapoli","html_url":"https://github.com/mnapoli","followers_url":"https://api.github.com/users/mnapoli/followers","following_url":"https://api.github.com/users/mnapoli/following{/other_user}","gists_url":"https://api.github.com/users/mnapoli/gists{/gist_id}","starred_url":"https://api.github.com/users/mnapoli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mnapoli/subscriptions","organizations_url":"https://api.github.com/users/mnapoli/orgs","repos_url":"https://api.github.com/users/mnapoli/repos","events_url":"https://api.github.com/users/mnapoli/events{/privacy}","received_events_url":"https://api.github.com/users/mnapoli/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mnapoli/PHP-DI/labels/enhancement","name":"enhancement","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/mnapoli/PHP-DI/milestones/14","html_url":"https://github.com/mnapoli/PHP-DI/milestones/5.0","labels_url":"https://api.github.com/repos/mnapoli/PHP-DI/milestones/14/labels","id":719110,"number":14,"title":"5.0","description":null,"creator":{"login":"mnapoli","id":720328,"avatar_url":"https://avatars.githubusercontent.com/u/720328?v=3","gravatar_id":"","url":"https://api.github.com/users/mnapoli","html_url":"https://github.com/mnapoli","followers_url":"https://api.github.com/users/mnapoli/followers","following_url":"https://api.github.com/users/mnapoli/following{/other_user}","gists_url":"https://api.github.com/users/mnapoli/gists{/gist_id}","starred_url":"https://api.github.com/users/mnapoli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mnapoli/subscriptions","organizations_url":"https://api.github.com/users/mnapoli/orgs","repos_url":"https://api.github.com/users/mnapoli/repos","events_url":"https://api.github.com/users/mnapoli/events{/privacy}","received_events_url":"https://api.github.com/users/mnapoli/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":17,"state":"open","created_at":"2014-07-12T18:56:34Z","updated_at":"2015-03-21T10:32:13Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2015-03-21T10:32:13Z","updated_at":"2015-03-21T10:32:13Z","closed_at":null,"body":"Just like in AngularJS we can do:\r\n\r\n```js\r\nangular.controller('MyController', ['$scope', 'dep1', 'dep2', function($scope, dep1, dep2) {\r\n  // ...\r\n}]);\r\n```\r\n\r\nIt would be great to be able to explicitly ask for dependencies:\r\n\r\n```php\r\n$container->call(['db.host', 'db.port', function ($host, $port) {\r\n    // ...\r\n}]);\r\n```\r\n\r\nCurrently `Container::call()` guesses the objects to inject using type-hints, but this doesn't always work. By using AngularJS's pattern it's already well known and it solves the problem."}}