{"action":"created","comment":{"url":"https://api.github.com/repos/container-interop/service-provider/pulls/comments/63206477","id":63206477,"diff_hunk":"@@ -216,34 +215,109 @@ If you register the service providers in the correct order in your container (A\n - [Stratigility Module](https://github.com/thecodingmachine/stratigility-harmony): A service provider for the Stratigility PSR-7 middleware.\n - [Whoops PSR-7 Middleware Module](https://github.com/thecodingmachine/whoops-middleware-universal-module): a service provider for the [Whoops](https://filp.github.io/whoops/) [PSR-7 middleware](https://github.com/franzliedke/whoops-middleware).\n \n-## FAQ\n+## Best practices\n+\n+### Playing nice with all containers\n+\n+The goal of this project is to offer a viable solution for **agnostic container configuration**. There is a wide variety of containers, and they can have very different behaviour.\n+In regard to service providers, it is important to understand there are 2 classes of containers:\n+\n+- *runtime containers*\n+- *compiled/cached containers*\n+\n+Runtime containers will typically instantiate service providers on each request. The `getServices` method will be called on each request to configure the container.\n+\n+By contrast, cached/compiled container will avoid calling `getServices` on each call by caching the results or dumping a PHP file containing the container. Therefore, service provider writers should not rely on the `getServices` method being always called before the factories.\n+\n+A good approximation is to say that service providers SHOULD be immutable. Once initialized, the state of the service provider should not change. ","path":"README.md","position":147,"original_position":147,"commit_id":"e91cce9e13c454f2690db09d3c032b3c20fd6f0e","original_commit_id":"e91cce9e13c454f2690db09d3c032b3c20fd6f0e","user":{"login":"moufmouf","id":1290952,"avatar_url":"https://avatars.githubusercontent.com/u/1290952?v=3","gravatar_id":"","url":"https://api.github.com/users/moufmouf","html_url":"https://github.com/moufmouf","followers_url":"https://api.github.com/users/moufmouf/followers","following_url":"https://api.github.com/users/moufmouf/following{/other_user}","gists_url":"https://api.github.com/users/moufmouf/gists{/gist_id}","starred_url":"https://api.github.com/users/moufmouf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moufmouf/subscriptions","organizations_url":"https://api.github.com/users/moufmouf/orgs","repos_url":"https://api.github.com/users/moufmouf/repos","events_url":"https://api.github.com/users/moufmouf/events{/privacy}","received_events_url":"https://api.github.com/users/moufmouf/received_events","type":"User","site_admin":false},"body":"Ok, I'll remove both \"Best practices > Playing nice with all containers\" and \"Best practices > Performance considerations\". I completely agree they don't belong this README. They should be put in a \"best practices guide\" or whatever we call that.","created_at":"2016-05-13T15:51:52Z","updated_at":"2016-05-13T15:51:52Z","html_url":"https://github.com/container-interop/service-provider/pull/20#discussion_r63206477","pull_request_url":"https://api.github.com/repos/container-interop/service-provider/pulls/20","_links":{"self":{"href":"https://api.github.com/repos/container-interop/service-provider/pulls/comments/63206477"},"html":{"href":"https://github.com/container-interop/service-provider/pull/20#discussion_r63206477"},"pull_request":{"href":"https://api.github.com/repos/container-interop/service-provider/pulls/20"}}},"pull_request":{"url":"https://api.github.com/repos/container-interop/service-provider/pulls/20","id":66545310,"html_url":"https://github.com/container-interop/service-provider/pull/20","diff_url":"https://github.com/container-interop/service-provider/pull/20.diff","patch_url":"https://github.com/container-interop/service-provider/pull/20.patch","issue_url":"https://api.github.com/repos/container-interop/service-provider/issues/20","number":20,"state":"open","locked":false,"title":"Switching to non-static getServices method returning callables","user":{"login":"moufmouf","id":1290952,"avatar_url":"https://avatars.githubusercontent.com/u/1290952?v=3","gravatar_id":"","url":"https://api.github.com/users/moufmouf","html_url":"https://github.com/moufmouf","followers_url":"https://api.github.com/users/moufmouf/followers","following_url":"https://api.github.com/users/moufmouf/following{/other_user}","gists_url":"https://api.github.com/users/moufmouf/gists{/gist_id}","starred_url":"https://api.github.com/users/moufmouf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moufmouf/subscriptions","organizations_url":"https://api.github.com/users/moufmouf/orgs","repos_url":"https://api.github.com/users/moufmouf/repos","events_url":"https://api.github.com/users/moufmouf/events{/privacy}","received_events_url":"https://api.github.com/users/moufmouf/received_events","type":"User","site_admin":false},"body":"Hey,\r\n\r\nFollowing discussion on #5 and #18, here is a proposal for a new version of the `ServiceProvider` interface with:\r\n\r\n- a non static `getServices` method\r\n- a `getServices` method that returns an array of callables\r\n\r\nI'm having a hard time wondering if we should not rename the `getServices` method (as it actually returns an array of factories).\r\n\r\nMaybe to something like `getFactories` or `serviceFactories`?\r\n\r\nAlso, I've added a fair amount of text. Not sure everything belongs to `README.md`. Comments are welcome!","created_at":"2016-04-14T20:06:17Z","updated_at":"2016-05-13T15:51:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"296cd4061cde69edd6f058de7b8577aff8bf897a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/container-interop/service-provider/pulls/20/commits","review_comments_url":"https://api.github.com/repos/container-interop/service-provider/pulls/20/comments","review_comment_url":"https://api.github.com/repos/container-interop/service-provider/pulls/comments{/number}","comments_url":"https://api.github.com/repos/container-interop/service-provider/issues/20/comments","statuses_url":"https://api.github.com/repos/container-interop/service-provider/statuses/e91cce9e13c454f2690db09d3c032b3c20fd6f0e","head":{"label":"container-interop:callables","ref":"callables","sha":"e91cce9e13c454f2690db09d3c032b3c20fd6f0e","user":{"login":"container-interop","id":6066761,"avatar_url":"https://avatars.githubusercontent.com/u/6066761?v=3","gravatar_id":"","url":"https://api.github.com/users/container-interop","html_url":"https://github.com/container-interop","followers_url":"https://api.github.com/users/container-interop/followers","following_url":"https://api.github.com/users/container-interop/following{/other_user}","gists_url":"https://api.github.com/users/container-interop/gists{/gist_id}","starred_url":"https://api.github.com/users/container-interop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/container-interop/subscriptions","organizations_url":"https://api.github.com/users/container-interop/orgs","repos_url":"https://api.github.com/users/container-interop/repos","events_url":"https://api.github.com/users/container-interop/events{/privacy}","received_events_url":"https://api.github.com/users/container-interop/received_events","type":"Organization","site_admin":false},"repo":{"id":51035236,"name":"service-provider","full_name":"container-interop/service-provider","owner":{"login":"container-interop","id":6066761,"avatar_url":"https://avatars.githubusercontent.com/u/6066761?v=3","gravatar_id":"","url":"https://api.github.com/users/container-interop","html_url":"https://github.com/container-interop","followers_url":"https://api.github.com/users/container-interop/followers","following_url":"https://api.github.com/users/container-interop/following{/other_user}","gists_url":"https://api.github.com/users/container-interop/gists{/gist_id}","starred_url":"https://api.github.com/users/container-interop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/container-interop/subscriptions","organizations_url":"https://api.github.com/users/container-interop/orgs","repos_url":"https://api.github.com/users/container-interop/repos","events_url":"https://api.github.com/users/container-interop/events{/privacy}","received_events_url":"https://api.github.com/users/container-interop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/container-interop/service-provider","description":"[EXPERIMENTAL] Promoting container interoperability through standard service providers","fork":false,"url":"https://api.github.com/repos/container-interop/service-provider","forks_url":"https://api.github.com/repos/container-interop/service-provider/forks","keys_url":"https://api.github.com/repos/container-interop/service-provider/keys{/key_id}","collaborators_url":"https://api.github.com/repos/container-interop/service-provider/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/container-interop/service-provider/teams","hooks_url":"https://api.github.com/repos/container-interop/service-provider/hooks","issue_events_url":"https://api.github.com/repos/container-interop/service-provider/issues/events{/number}","events_url":"https://api.github.com/repos/container-interop/service-provider/events","assignees_url":"https://api.github.com/repos/container-interop/service-provider/assignees{/user}","branches_url":"https://api.github.com/repos/container-interop/service-provider/branches{/branch}","tags_url":"https://api.github.com/repos/container-interop/service-provider/tags","blobs_url":"https://api.github.com/repos/container-interop/service-provider/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/container-interop/service-provider/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/container-interop/service-provider/git/refs{/sha}","trees_url":"https://api.github.com/repos/container-interop/service-provider/git/trees{/sha}","statuses_url":"https://api.github.com/repos/container-interop/service-provider/statuses/{sha}","languages_url":"https://api.github.com/repos/container-interop/service-provider/languages","stargazers_url":"https://api.github.com/repos/container-interop/service-provider/stargazers","contributors_url":"https://api.github.com/repos/container-interop/service-provider/contributors","subscribers_url":"https://api.github.com/repos/container-interop/service-provider/subscribers","subscription_url":"https://api.github.com/repos/container-interop/service-provider/subscription","commits_url":"https://api.github.com/repos/container-interop/service-provider/commits{/sha}","git_commits_url":"https://api.github.com/repos/container-interop/service-provider/git/commits{/sha}","comments_url":"https://api.github.com/repos/container-interop/service-provider/comments{/number}","issue_comment_url":"https://api.github.com/repos/container-interop/service-provider/issues/comments{/number}","contents_url":"https://api.github.com/repos/container-interop/service-provider/contents/{+path}","compare_url":"https://api.github.com/repos/container-interop/service-provider/compare/{base}...{head}","merges_url":"https://api.github.com/repos/container-interop/service-provider/merges","archive_url":"https://api.github.com/repos/container-interop/service-provider/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/container-interop/service-provider/downloads","issues_url":"https://api.github.com/repos/container-interop/service-provider/issues{/number}","pulls_url":"https://api.github.com/repos/container-interop/service-provider/pulls{/number}","milestones_url":"https://api.github.com/repos/container-interop/service-provider/milestones{/number}","notifications_url":"https://api.github.com/repos/container-interop/service-provider/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/container-interop/service-provider/labels{/name}","releases_url":"https://api.github.com/repos/container-interop/service-provider/releases{/id}","deployments_url":"https://api.github.com/repos/container-interop/service-provider/deployments","created_at":"2016-02-03T22:27:25Z","updated_at":"2016-04-20T15:37:54Z","pushed_at":"2016-05-10T12:53:01Z","git_url":"git://github.com/container-interop/service-provider.git","ssh_url":"git@github.com:container-interop/service-provider.git","clone_url":"https://github.com/container-interop/service-provider.git","svn_url":"https://github.com/container-interop/service-provider","homepage":"","size":22,"stargazers_count":9,"watchers_count":9,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":5,"forks":2,"open_issues":5,"watchers":9,"default_branch":"master"}},"base":{"label":"container-interop:master","ref":"master","sha":"cb91032576225cfb0a5b10fbc4eb278bc9aa0631","user":{"login":"container-interop","id":6066761,"avatar_url":"https://avatars.githubusercontent.com/u/6066761?v=3","gravatar_id":"","url":"https://api.github.com/users/container-interop","html_url":"https://github.com/container-interop","followers_url":"https://api.github.com/users/container-interop/followers","following_url":"https://api.github.com/users/container-interop/following{/other_user}","gists_url":"https://api.github.com/users/container-interop/gists{/gist_id}","starred_url":"https://api.github.com/users/container-interop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/container-interop/subscriptions","organizations_url":"https://api.github.com/users/container-interop/orgs","repos_url":"https://api.github.com/users/container-interop/repos","events_url":"https://api.github.com/users/container-interop/events{/privacy}","received_events_url":"https://api.github.com/users/container-interop/received_events","type":"Organization","site_admin":false},"repo":{"id":51035236,"name":"service-provider","full_name":"container-interop/service-provider","owner":{"login":"container-interop","id":6066761,"avatar_url":"https://avatars.githubusercontent.com/u/6066761?v=3","gravatar_id":"","url":"https://api.github.com/users/container-interop","html_url":"https://github.com/container-interop","followers_url":"https://api.github.com/users/container-interop/followers","following_url":"https://api.github.com/users/container-interop/following{/other_user}","gists_url":"https://api.github.com/users/container-interop/gists{/gist_id}","starred_url":"https://api.github.com/users/container-interop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/container-interop/subscriptions","organizations_url":"https://api.github.com/users/container-interop/orgs","repos_url":"https://api.github.com/users/container-interop/repos","events_url":"https://api.github.com/users/container-interop/events{/privacy}","received_events_url":"https://api.github.com/users/container-interop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/container-interop/service-provider","description":"[EXPERIMENTAL] Promoting container interoperability through standard service providers","fork":false,"url":"https://api.github.com/repos/container-interop/service-provider","forks_url":"https://api.github.com/repos/container-interop/service-provider/forks","keys_url":"https://api.github.com/repos/container-interop/service-provider/keys{/key_id}","collaborators_url":"https://api.github.com/repos/container-interop/service-provider/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/container-interop/service-provider/teams","hooks_url":"https://api.github.com/repos/container-interop/service-provider/hooks","issue_events_url":"https://api.github.com/repos/container-interop/service-provider/issues/events{/number}","events_url":"https://api.github.com/repos/container-interop/service-provider/events","assignees_url":"https://api.github.com/repos/container-interop/service-provider/assignees{/user}","branches_url":"https://api.github.com/repos/container-interop/service-provider/branches{/branch}","tags_url":"https://api.github.com/repos/container-interop/service-provider/tags","blobs_url":"https://api.github.com/repos/container-interop/service-provider/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/container-interop/service-provider/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/container-interop/service-provider/git/refs{/sha}","trees_url":"https://api.github.com/repos/container-interop/service-provider/git/trees{/sha}","statuses_url":"https://api.github.com/repos/container-interop/service-provider/statuses/{sha}","languages_url":"https://api.github.com/repos/container-interop/service-provider/languages","stargazers_url":"https://api.github.com/repos/container-interop/service-provider/stargazers","contributors_url":"https://api.github.com/repos/container-interop/service-provider/contributors","subscribers_url":"https://api.github.com/repos/container-interop/service-provider/subscribers","subscription_url":"https://api.github.com/repos/container-interop/service-provider/subscription","commits_url":"https://api.github.com/repos/container-interop/service-provider/commits{/sha}","git_commits_url":"https://api.github.com/repos/container-interop/service-provider/git/commits{/sha}","comments_url":"https://api.github.com/repos/container-interop/service-provider/comments{/number}","issue_comment_url":"https://api.github.com/repos/container-interop/service-provider/issues/comments{/number}","contents_url":"https://api.github.com/repos/container-interop/service-provider/contents/{+path}","compare_url":"https://api.github.com/repos/container-interop/service-provider/compare/{base}...{head}","merges_url":"https://api.github.com/repos/container-interop/service-provider/merges","archive_url":"https://api.github.com/repos/container-interop/service-provider/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/container-interop/service-provider/downloads","issues_url":"https://api.github.com/repos/container-interop/service-provider/issues{/number}","pulls_url":"https://api.github.com/repos/container-interop/service-provider/pulls{/number}","milestones_url":"https://api.github.com/repos/container-interop/service-provider/milestones{/number}","notifications_url":"https://api.github.com/repos/container-interop/service-provider/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/container-interop/service-provider/labels{/name}","releases_url":"https://api.github.com/repos/container-interop/service-provider/releases{/id}","deployments_url":"https://api.github.com/repos/container-interop/service-provider/deployments","created_at":"2016-02-03T22:27:25Z","updated_at":"2016-04-20T15:37:54Z","pushed_at":"2016-05-10T12:53:01Z","git_url":"git://github.com/container-interop/service-provider.git","ssh_url":"git@github.com:container-interop/service-provider.git","clone_url":"https://github.com/container-interop/service-provider.git","svn_url":"https://github.com/container-interop/service-provider","homepage":"","size":22,"stargazers_count":9,"watchers_count":9,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":5,"forks":2,"open_issues":5,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/container-interop/service-provider/pulls/20"},"html":{"href":"https://github.com/container-interop/service-provider/pull/20"},"issue":{"href":"https://api.github.com/repos/container-interop/service-provider/issues/20"},"comments":{"href":"https://api.github.com/repos/container-interop/service-provider/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/container-interop/service-provider/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/container-interop/service-provider/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/container-interop/service-provider/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/container-interop/service-provider/statuses/e91cce9e13c454f2690db09d3c032b3c20fd6f0e"}}}}