{"action":"created","issue":{"url":"https://api.github.com/repos/thephpleague/container/issues/18","labels_url":"https://api.github.com/repos/thephpleague/container/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/thephpleague/container/issues/18/comments","events_url":"https://api.github.com/repos/thephpleague/container/issues/18/events","html_url":"https://github.com/thephpleague/container/pull/18","id":56014234,"number":18,"title":"Introduce Service Provider Functionality","user":{"login":"philipobenito","id":2077289,"avatar_url":"https://avatars.githubusercontent.com/u/2077289?v=3","gravatar_id":"","url":"https://api.github.com/users/philipobenito","html_url":"https://github.com/philipobenito","followers_url":"https://api.github.com/users/philipobenito/followers","following_url":"https://api.github.com/users/philipobenito/following{/other_user}","gists_url":"https://api.github.com/users/philipobenito/gists{/gist_id}","starred_url":"https://api.github.com/users/philipobenito/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philipobenito/subscriptions","organizations_url":"https://api.github.com/users/philipobenito/orgs","repos_url":"https://api.github.com/users/philipobenito/repos","events_url":"https://api.github.com/users/philipobenito/events{/privacy}","received_events_url":"https://api.github.com/users/philipobenito/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":34,"created_at":"2015-01-30T09:58:27Z","updated_at":"2015-01-30T13:54:26Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/thephpleague/container/pulls/18","html_url":"https://github.com/thephpleague/container/pull/18","diff_url":"https://github.com/thephpleague/container/pull/18.diff","patch_url":"https://github.com/thephpleague/container/pull/18.patch"},"body":"This PR provides functionality for Service Providers and addresses #12.\r\n\r\n### Usage\r\n\r\nSimplest use case would be to build a service provider and register an instance of that.\r\n\r\n```php\r\n<?php\r\n\r\nnamespace Acme\\ServiceProvider;\r\n\r\nuse League\\Container\\ServiceProvider;\r\n\r\nclass SomeServiceProvider extends ServiceProvider\r\n{\r\n    protected $provides = ['some.service'];\r\n\r\n    public function register()\r\n    {\r\n        $this->getContainer()->add('some.service', 'SomeService');\r\n    }\r\n}\r\n```\r\n\r\n```php\r\n$container->add(new Acme\\ServiceProvider\\SomeServiceProvider);\r\n\r\n// resolve the service provider by the name registered\r\n$container->get('some.service');\r\n```\r\n\r\n#### Lazy Loading\r\n\r\nYou can register a service provider by string reference to the fully qualified namespace of the service provider. The `addServiceProvider` expects you to provide a name/alias as the first argument.\r\n\r\n```php\r\n$container->addServiceProvider('Acme\\ServiceProvider\\SomeServiceProvider');\r\n\r\n$container->get('some.service');\r\n```"},"comment":{"url":"https://api.github.com/repos/thephpleague/container/issues/comments/72203608","html_url":"https://github.com/thephpleague/container/pull/18#issuecomment-72203608","issue_url":"https://api.github.com/repos/thephpleague/container/issues/18","id":72203608,"user":{"login":"philipobenito","id":2077289,"avatar_url":"https://avatars.githubusercontent.com/u/2077289?v=3","gravatar_id":"","url":"https://api.github.com/users/philipobenito","html_url":"https://github.com/philipobenito","followers_url":"https://api.github.com/users/philipobenito/followers","following_url":"https://api.github.com/users/philipobenito/following{/other_user}","gists_url":"https://api.github.com/users/philipobenito/gists{/gist_id}","starred_url":"https://api.github.com/users/philipobenito/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philipobenito/subscriptions","organizations_url":"https://api.github.com/users/philipobenito/orgs","repos_url":"https://api.github.com/users/philipobenito/repos","events_url":"https://api.github.com/users/philipobenito/events{/privacy}","received_events_url":"https://api.github.com/users/philipobenito/received_events","type":"User","site_admin":false},"created_at":"2015-01-30T13:54:26Z","updated_at":"2015-01-30T13:54:26Z","body":"I think in regards to the providers we should do a check. However, whatever the provider does we shouldn't care, should just act as the container already does and override the definition."}}