{"action":"created","comment":{"url":"https://api.github.com/repos/PHP-DI/PHP-DI/pulls/comments/37703675","id":37703675,"diff_hunk":"@@ -0,0 +1,136 @@\n+---\n+layout: documentation\n+---\n+\n+# PHP-DI in Zend Framework 2\n+\n+## Set up\n+\n+If you are using ZF2, PHP-DI provides easy and clean integration so that you don't have\n+to call the container (thus avoiding the Service Locator pattern).\n+\n+First, install the bridge to ZF2:\n+\n+```\n+composer require php-di/zf2-bridge\n+```\n+\n+To use PHP-DI in your ZF2 application, you need to edit `application_root/config/module.config.php`:\n+\n+```php\n+    // ...\n+    'modules' => [\n+        ...\n+        'DI\\ZendFramework2',\n+        ...\n+    ],\n+    \n+    'service_manager' => [\n+        // ...\n+        'factories' => [\n+            'DI\\Container' => 'DI\\ZendFramework2\\Service\\DIContainerFactory',\n+        ],\n+    ],\n+```\n+\n+That's it!\n+\n+Now you dependencies are injected in your controllers!\n+\n+As you can see since PHP-DI 5 it's necessary to enable [annotations](../annotations.md) because they are disabled by default.\n+\n+## Usage\n+\n+Now you can inject dependencies in your controllers!\n+\n+For example, here is the GuestbookController of the quickstart:\n+\n+```php\n+class GuestbookController extends AbstractActionController\n+{\n+    /**\n+     * This dependency will be injected by PHP-DI\n+     * @Inject\n+     * @var \\Application\\Service\\GuestbookService\n+     */\n+    private $guestbookService;\n+\n+    public function indexAction()\n+    {\n+        $this->view->entries = $this->guestbookService->getAllEntries();\n+    }\n+}\n+```\n+\n+If you'd like to specify the di configuration yourself, create this file: `application_root/config/php-di.config.php`\n+and save it with your PHP DI configuration e.g. like this:\n+\n+```\n+return [\n+    'Application\\Service\\GreetingServiceInterface' => Di\\object('Application\\Service\\GreetingService'),\n+];\n+```\n+\n+Head over to [PHP-DI's documentation](http://php-di.org/doc/) if needed.\n+\n+## Fine tuning\n+\n+To configure the module, you have to override the module config somewhere at config/autoload/global.php \n+or config/autoload/local.php.\n+  \n+```php\n+return [\n+    'phpdi-zf2' => [\n+        ...\n+    ]\n+];\n+```\n+\n+### Override definitions file location\n+\n+```php\n+return [\n+    'phpdi-zf2' => [\n+        'definitionsFile' => realpath(__DIR__ . '/../my.custom.def.config.php'),\n+    ]\n+];\n+```\n+\n+### Enable or disable annotations\n+\n+```php\n+return [\n+    'phpdi-zf2' => [\n+        'useAnntotations' => true,\n+    ]\n+];\n+```\n+\n+### Enable file cache\n+\n+```php\n+return [\n+    'phpdi-zf2' => [\n+        'cache' => [\n+            'adapter' => 'filesystem',\n+            'namespace' => 'your_di_cache_key',\n+            'directory' => 'your_cache_directory', // default value is data/php-di/cache\n+        ],\n+    ]\n+];\n+```\n+\n+### Enable redis cache\n+\n+```php\n+return [\n+    'phpdi-zf2' => [\n+        'cache' => [\n+            'namespace' => 'your_di_cache_key',\n+            'adapter' => 'redis',\n+            'host' => 'localhost', // default is localhost\n+            'port' => 6379, // default is 6379\n+        ],\n+    ]\n+];\n+```","path":"doc/frameworks/zf2.md","position":136,"original_position":136,"commit_id":"e29cfbcb7961f625717b07b2f2156330d7606f7d","original_commit_id":"e29cfbcb7961f625717b07b2f2156330d7606f7d","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},"body":"I highly advise against using the Redis cache implementation as it would be much too slow for DI cache. The best cache (and probably the only one that should be used) is the ApcCache, which is fast enough because it's stored locally in memory.\r\n\r\nSo maybe it's best not to document Redis cache, and document ApcCache instead?","created_at":"2015-08-23T08:35:22Z","updated_at":"2015-08-23T08:35:22Z","html_url":"https://github.com/PHP-DI/PHP-DI/pull/301#discussion_r37703675","pull_request_url":"https://api.github.com/repos/PHP-DI/PHP-DI/pulls/301","_links":{"self":{"href":"https://api.github.com/repos/PHP-DI/PHP-DI/pulls/comments/37703675"},"html":{"href":"https://github.com/PHP-DI/PHP-DI/pull/301#discussion_r37703675"},"pull_request":{"href":"https://api.github.com/repos/PHP-DI/PHP-DI/pulls/301"}}},"pull_request":{"url":"https://api.github.com/repos/PHP-DI/PHP-DI/pulls/301","id":42986386,"html_url":"https://github.com/PHP-DI/PHP-DI/pull/301","diff_url":"https://github.com/PHP-DI/PHP-DI/pull/301.diff","patch_url":"https://github.com/PHP-DI/PHP-DI/pull/301.patch","issue_url":"https://api.github.com/repos/PHP-DI/PHP-DI/issues/301","number":301,"state":"open","locked":false,"title":"docs updated for zf2 pridge","user":{"login":"Rastusik","id":1735097,"avatar_url":"https://avatars.githubusercontent.com/u/1735097?v=3","gravatar_id":"","url":"https://api.github.com/users/Rastusik","html_url":"https://github.com/Rastusik","followers_url":"https://api.github.com/users/Rastusik/followers","following_url":"https://api.github.com/users/Rastusik/following{/other_user}","gists_url":"https://api.github.com/users/Rastusik/gists{/gist_id}","starred_url":"https://api.github.com/users/Rastusik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rastusik/subscriptions","organizations_url":"https://api.github.com/users/Rastusik/orgs","repos_url":"https://api.github.com/users/Rastusik/repos","events_url":"https://api.github.com/users/Rastusik/events{/privacy}","received_events_url":"https://api.github.com/users/Rastusik/received_events","type":"User","site_admin":false},"body":"@mnapoli  I've updated the docs for the php di zf2 bridge. Could you review the changes and merge if everything is ok? thanks","created_at":"2015-08-20T22:33:59Z","updated_at":"2015-08-23T08:35:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dc142a0dd5a4f203a1f7779b0a2c4f65d15e3bd7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/PHP-DI/PHP-DI/pulls/301/commits","review_comments_url":"https://api.github.com/repos/PHP-DI/PHP-DI/pulls/301/comments","review_comment_url":"https://api.github.com/repos/PHP-DI/PHP-DI/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PHP-DI/PHP-DI/issues/301/comments","statuses_url":"https://api.github.com/repos/PHP-DI/PHP-DI/statuses/e29cfbcb7961f625717b07b2f2156330d7606f7d","head":{"label":"Rastusik:master","ref":"master","sha":"e29cfbcb7961f625717b07b2f2156330d7606f7d","user":{"login":"Rastusik","id":1735097,"avatar_url":"https://avatars.githubusercontent.com/u/1735097?v=3","gravatar_id":"","url":"https://api.github.com/users/Rastusik","html_url":"https://github.com/Rastusik","followers_url":"https://api.github.com/users/Rastusik/followers","following_url":"https://api.github.com/users/Rastusik/following{/other_user}","gists_url":"https://api.github.com/users/Rastusik/gists{/gist_id}","starred_url":"https://api.github.com/users/Rastusik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rastusik/subscriptions","organizations_url":"https://api.github.com/users/Rastusik/orgs","repos_url":"https://api.github.com/users/Rastusik/repos","events_url":"https://api.github.com/users/Rastusik/events{/privacy}","received_events_url":"https://api.github.com/users/Rastusik/received_events","type":"User","site_admin":false},"repo":{"id":41121498,"name":"PHP-DI","full_name":"Rastusik/PHP-DI","owner":{"login":"Rastusik","id":1735097,"avatar_url":"https://avatars.githubusercontent.com/u/1735097?v=3","gravatar_id":"","url":"https://api.github.com/users/Rastusik","html_url":"https://github.com/Rastusik","followers_url":"https://api.github.com/users/Rastusik/followers","following_url":"https://api.github.com/users/Rastusik/following{/other_user}","gists_url":"https://api.github.com/users/Rastusik/gists{/gist_id}","starred_url":"https://api.github.com/users/Rastusik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rastusik/subscriptions","organizations_url":"https://api.github.com/users/Rastusik/orgs","repos_url":"https://api.github.com/users/Rastusik/repos","events_url":"https://api.github.com/users/Rastusik/events{/privacy}","received_events_url":"https://api.github.com/users/Rastusik/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Rastusik/PHP-DI","description":"The dependency injection container for humans","fork":true,"url":"https://api.github.com/repos/Rastusik/PHP-DI","forks_url":"https://api.github.com/repos/Rastusik/PHP-DI/forks","keys_url":"https://api.github.com/repos/Rastusik/PHP-DI/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Rastusik/PHP-DI/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Rastusik/PHP-DI/teams","hooks_url":"https://api.github.com/repos/Rastusik/PHP-DI/hooks","issue_events_url":"https://api.github.com/repos/Rastusik/PHP-DI/issues/events{/number}","events_url":"https://api.github.com/repos/Rastusik/PHP-DI/events","assignees_url":"https://api.github.com/repos/Rastusik/PHP-DI/assignees{/user}","branches_url":"https://api.github.com/repos/Rastusik/PHP-DI/branches{/branch}","tags_url":"https://api.github.com/repos/Rastusik/PHP-DI/tags","blobs_url":"https://api.github.com/repos/Rastusik/PHP-DI/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Rastusik/PHP-DI/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Rastusik/PHP-DI/git/refs{/sha}","trees_url":"https://api.github.com/repos/Rastusik/PHP-DI/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Rastusik/PHP-DI/statuses/{sha}","languages_url":"https://api.github.com/repos/Rastusik/PHP-DI/languages","stargazers_url":"https://api.github.com/repos/Rastusik/PHP-DI/stargazers","contributors_url":"https://api.github.com/repos/Rastusik/PHP-DI/contributors","subscribers_url":"https://api.github.com/repos/Rastusik/PHP-DI/subscribers","subscription_url":"https://api.github.com/repos/Rastusik/PHP-DI/subscription","commits_url":"https://api.github.com/repos/Rastusik/PHP-DI/commits{/sha}","git_commits_url":"https://api.github.com/repos/Rastusik/PHP-DI/git/commits{/sha}","comments_url":"https://api.github.com/repos/Rastusik/PHP-DI/comments{/number}","issue_comment_url":"https://api.github.com/repos/Rastusik/PHP-DI/issues/comments{/number}","contents_url":"https://api.github.com/repos/Rastusik/PHP-DI/contents/{+path}","compare_url":"https://api.github.com/repos/Rastusik/PHP-DI/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Rastusik/PHP-DI/merges","archive_url":"https://api.github.com/repos/Rastusik/PHP-DI/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Rastusik/PHP-DI/downloads","issues_url":"https://api.github.com/repos/Rastusik/PHP-DI/issues{/number}","pulls_url":"https://api.github.com/repos/Rastusik/PHP-DI/pulls{/number}","milestones_url":"https://api.github.com/repos/Rastusik/PHP-DI/milestones{/number}","notifications_url":"https://api.github.com/repos/Rastusik/PHP-DI/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Rastusik/PHP-DI/labels{/name}","releases_url":"https://api.github.com/repos/Rastusik/PHP-DI/releases{/id}","created_at":"2015-08-20T22:20:48Z","updated_at":"2015-08-20T22:20:49Z","pushed_at":"2015-08-20T22:32:19Z","git_url":"git://github.com/Rastusik/PHP-DI.git","ssh_url":"git@github.com:Rastusik/PHP-DI.git","clone_url":"https://github.com/Rastusik/PHP-DI.git","svn_url":"https://github.com/Rastusik/PHP-DI","homepage":"php-di.org","size":7830,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"PHP-DI:master","ref":"master","sha":"bd8c5f616324ab175ef01151740b7f54fb9c2851","user":{"login":"PHP-DI","id":7814911,"avatar_url":"https://avatars.githubusercontent.com/u/7814911?v=3","gravatar_id":"","url":"https://api.github.com/users/PHP-DI","html_url":"https://github.com/PHP-DI","followers_url":"https://api.github.com/users/PHP-DI/followers","following_url":"https://api.github.com/users/PHP-DI/following{/other_user}","gists_url":"https://api.github.com/users/PHP-DI/gists{/gist_id}","starred_url":"https://api.github.com/users/PHP-DI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PHP-DI/subscriptions","organizations_url":"https://api.github.com/users/PHP-DI/orgs","repos_url":"https://api.github.com/users/PHP-DI/repos","events_url":"https://api.github.com/users/PHP-DI/events{/privacy}","received_events_url":"https://api.github.com/users/PHP-DI/received_events","type":"Organization","site_admin":false},"repo":{"id":3751713,"name":"PHP-DI","full_name":"PHP-DI/PHP-DI","owner":{"login":"PHP-DI","id":7814911,"avatar_url":"https://avatars.githubusercontent.com/u/7814911?v=3","gravatar_id":"","url":"https://api.github.com/users/PHP-DI","html_url":"https://github.com/PHP-DI","followers_url":"https://api.github.com/users/PHP-DI/followers","following_url":"https://api.github.com/users/PHP-DI/following{/other_user}","gists_url":"https://api.github.com/users/PHP-DI/gists{/gist_id}","starred_url":"https://api.github.com/users/PHP-DI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PHP-DI/subscriptions","organizations_url":"https://api.github.com/users/PHP-DI/orgs","repos_url":"https://api.github.com/users/PHP-DI/repos","events_url":"https://api.github.com/users/PHP-DI/events{/privacy}","received_events_url":"https://api.github.com/users/PHP-DI/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PHP-DI/PHP-DI","description":"The dependency injection container for humans","fork":false,"url":"https://api.github.com/repos/PHP-DI/PHP-DI","forks_url":"https://api.github.com/repos/PHP-DI/PHP-DI/forks","keys_url":"https://api.github.com/repos/PHP-DI/PHP-DI/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PHP-DI/PHP-DI/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PHP-DI/PHP-DI/teams","hooks_url":"https://api.github.com/repos/PHP-DI/PHP-DI/hooks","issue_events_url":"https://api.github.com/repos/PHP-DI/PHP-DI/issues/events{/number}","events_url":"https://api.github.com/repos/PHP-DI/PHP-DI/events","assignees_url":"https://api.github.com/repos/PHP-DI/PHP-DI/assignees{/user}","branches_url":"https://api.github.com/repos/PHP-DI/PHP-DI/branches{/branch}","tags_url":"https://api.github.com/repos/PHP-DI/PHP-DI/tags","blobs_url":"https://api.github.com/repos/PHP-DI/PHP-DI/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PHP-DI/PHP-DI/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PHP-DI/PHP-DI/git/refs{/sha}","trees_url":"https://api.github.com/repos/PHP-DI/PHP-DI/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PHP-DI/PHP-DI/statuses/{sha}","languages_url":"https://api.github.com/repos/PHP-DI/PHP-DI/languages","stargazers_url":"https://api.github.com/repos/PHP-DI/PHP-DI/stargazers","contributors_url":"https://api.github.com/repos/PHP-DI/PHP-DI/contributors","subscribers_url":"https://api.github.com/repos/PHP-DI/PHP-DI/subscribers","subscription_url":"https://api.github.com/repos/PHP-DI/PHP-DI/subscription","commits_url":"https://api.github.com/repos/PHP-DI/PHP-DI/commits{/sha}","git_commits_url":"https://api.github.com/repos/PHP-DI/PHP-DI/git/commits{/sha}","comments_url":"https://api.github.com/repos/PHP-DI/PHP-DI/comments{/number}","issue_comment_url":"https://api.github.com/repos/PHP-DI/PHP-DI/issues/comments{/number}","contents_url":"https://api.github.com/repos/PHP-DI/PHP-DI/contents/{+path}","compare_url":"https://api.github.com/repos/PHP-DI/PHP-DI/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PHP-DI/PHP-DI/merges","archive_url":"https://api.github.com/repos/PHP-DI/PHP-DI/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PHP-DI/PHP-DI/downloads","issues_url":"https://api.github.com/repos/PHP-DI/PHP-DI/issues{/number}","pulls_url":"https://api.github.com/repos/PHP-DI/PHP-DI/pulls{/number}","milestones_url":"https://api.github.com/repos/PHP-DI/PHP-DI/milestones{/number}","notifications_url":"https://api.github.com/repos/PHP-DI/PHP-DI/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PHP-DI/PHP-DI/labels{/name}","releases_url":"https://api.github.com/repos/PHP-DI/PHP-DI/releases{/id}","created_at":"2012-03-17T23:59:36Z","updated_at":"2015-08-22T12:54:28Z","pushed_at":"2015-08-20T22:33:59Z","git_url":"git://github.com/PHP-DI/PHP-DI.git","ssh_url":"git@github.com:PHP-DI/PHP-DI.git","clone_url":"https://github.com/PHP-DI/PHP-DI.git","svn_url":"https://github.com/PHP-DI/PHP-DI","homepage":"php-di.org","size":7830,"stargazers_count":531,"watchers_count":531,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":79,"mirror_url":null,"open_issues_count":25,"forks":79,"open_issues":25,"watchers":531,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PHP-DI/PHP-DI/pulls/301"},"html":{"href":"https://github.com/PHP-DI/PHP-DI/pull/301"},"issue":{"href":"https://api.github.com/repos/PHP-DI/PHP-DI/issues/301"},"comments":{"href":"https://api.github.com/repos/PHP-DI/PHP-DI/issues/301/comments"},"review_comments":{"href":"https://api.github.com/repos/PHP-DI/PHP-DI/pulls/301/comments"},"review_comment":{"href":"https://api.github.com/repos/PHP-DI/PHP-DI/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PHP-DI/PHP-DI/pulls/301/commits"},"statuses":{"href":"https://api.github.com/repos/PHP-DI/PHP-DI/statuses/e29cfbcb7961f625717b07b2f2156330d7606f7d"}}}}