{"action":"created","issue":{"url":"https://api.github.com/repos/wp-cli/wp-cli/issues/2493","repository_url":"https://api.github.com/repos/wp-cli/wp-cli","labels_url":"https://api.github.com/repos/wp-cli/wp-cli/issues/2493/labels{/name}","comments_url":"https://api.github.com/repos/wp-cli/wp-cli/issues/2493/comments","events_url":"https://api.github.com/repos/wp-cli/wp-cli/issues/2493/events","html_url":"https://github.com/wp-cli/wp-cli/issues/2493","id":134861274,"number":2493,"title":"wp package: Don't install WP-CLI when identified as a dependency","user":{"login":"danielbachhuber","id":36432,"avatar_url":"https://avatars.githubusercontent.com/u/36432?v=3","gravatar_id":"","url":"https://api.github.com/users/danielbachhuber","html_url":"https://github.com/danielbachhuber","followers_url":"https://api.github.com/users/danielbachhuber/followers","following_url":"https://api.github.com/users/danielbachhuber/following{/other_user}","gists_url":"https://api.github.com/users/danielbachhuber/gists{/gist_id}","starred_url":"https://api.github.com/users/danielbachhuber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielbachhuber/subscriptions","organizations_url":"https://api.github.com/users/danielbachhuber/orgs","repos_url":"https://api.github.com/users/danielbachhuber/repos","events_url":"https://api.github.com/users/danielbachhuber/events{/privacy}","received_events_url":"https://api.github.com/users/danielbachhuber/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/wp-cli/wp-cli/labels/bug","name":"bug","color":"e11d21"},{"url":"https://api.github.com/repos/wp-cli/wp-cli/labels/scope:command","name":"scope:command","color":"e102d8"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/wp-cli/wp-cli/milestones/42","html_url":"https://github.com/wp-cli/wp-cli/milestones/0.23.0","labels_url":"https://api.github.com/repos/wp-cli/wp-cli/milestones/42/labels","id":1490063,"number":42,"title":"0.23.0","description":"","creator":{"login":"danielbachhuber","id":36432,"avatar_url":"https://avatars.githubusercontent.com/u/36432?v=3","gravatar_id":"","url":"https://api.github.com/users/danielbachhuber","html_url":"https://github.com/danielbachhuber","followers_url":"https://api.github.com/users/danielbachhuber/followers","following_url":"https://api.github.com/users/danielbachhuber/following{/other_user}","gists_url":"https://api.github.com/users/danielbachhuber/gists{/gist_id}","starred_url":"https://api.github.com/users/danielbachhuber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielbachhuber/subscriptions","organizations_url":"https://api.github.com/users/danielbachhuber/orgs","repos_url":"https://api.github.com/users/danielbachhuber/repos","events_url":"https://api.github.com/users/danielbachhuber/events{/privacy}","received_events_url":"https://api.github.com/users/danielbachhuber/received_events","type":"User","site_admin":false},"open_issues":7,"closed_issues":107,"state":"open","created_at":"2016-01-07T18:03:09Z","updated_at":"2016-03-08T19:25:28Z","due_on":"2016-03-23T07:00:00Z","closed_at":null},"comments":3,"created_at":"2016-02-19T13:11:16Z","updated_at":"2016-03-08T19:27:10Z","closed_at":null,"body":"Some packages define `wp-cli/wp-cli` as a dependency:\r\n\r\n```\r\n{\r\n    \"name\": \"c10b10/wp-cli-deploy\",\r\n    \"description\": \"Deploys the local WordPress database or the uploads directory to a remote \r\n    \"require\": {\r\n        \"php\": \">=5.4\",\r\n        \"wp-cli/wp-cli\": \">=0.14\"\r\n    },\r\n}\r\n```\r\n\r\nThis is permissible because we do support installing WP-CLI as a dependency on a Composer project.\r\n\r\nHowever, `wp package install` shouldn't ever install WP-CLI as a dependency:\r\n\r\n```\r\nalty-wordpress ➜  wordpress-develop.dev  wp package install c10b10/wp-cli-deploy\r\nInstalling c10b10/wp-cli-deploy (dev-master)\r\nUpdating /home/vagrant/.wp-cli/packages/composer.json to require the package...\r\nUsing Composer to install the package...\r\n - Installing package\r\n - Error: wp-cli/wp-cli dev-master requires nb/oxymel 0.1.0 -> satisfiable by nb/oxymel[v0.1.0].\r\n - Installing package\r\n - Error: wp-cli/wp-cli dev-master requires symfony/translation 2.7.* -> satisfiable by symfony/translation[2.7.x-dev, v2.7.0, v2.7.0-BETA1, v2.7.0-BETA2, v2.7.1, v2.7.2, v2.7.3, v2.7.4, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9].\r\n - Installing package\r\n - Error: wp-cli/wp-cli dev-master requires symfony/event-dispatcher 2.7.* -> satisfiable by symfony/event-dispatcher[2.7.x-dev, v2.7.0, v2.7.0-BETA1, v2.7.0-BETA2, v2.7.1, v2.7.2, v2.7.3, v2.7.4, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9].\r\n - Installing package\r\n - Error: wp-cli/wp-cli dev-master requires symfony/dependency-injection 2.7.* -> satisfiable by symfony/dependency-injection[2.7.x-dev, v2.7.0, v2.7.0-BETA1, v2.7.0-BETA2, v2.7.1, v2.7.2, v2.7.3, v2.7.4, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9].\r\n - Installing package\r\n - Error: wp-cli/wp-cli dev-master requires symfony/console 2.7.* -> satisfiable by symfony/console[2.7.x-dev, v2.7.0, v2.7.0-BETA1, v2.7.0-BETA2, v2.7.1, v2.7.2, v2.7.3, v2.7.4, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9].\r\n```\r\n\r\nNot sure how difficult it is to overload Composer's dependency resolution process.\r\n\r\nRelated #1564"},"comment":{"url":"https://api.github.com/repos/wp-cli/wp-cli/issues/comments/193932025","html_url":"https://github.com/wp-cli/wp-cli/issues/2493#issuecomment-193932025","issue_url":"https://api.github.com/repos/wp-cli/wp-cli/issues/2493","id":193932025,"user":{"login":"schlessera","id":83631,"avatar_url":"https://avatars.githubusercontent.com/u/83631?v=3","gravatar_id":"","url":"https://api.github.com/users/schlessera","html_url":"https://github.com/schlessera","followers_url":"https://api.github.com/users/schlessera/followers","following_url":"https://api.github.com/users/schlessera/following{/other_user}","gists_url":"https://api.github.com/users/schlessera/gists{/gist_id}","starred_url":"https://api.github.com/users/schlessera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schlessera/subscriptions","organizations_url":"https://api.github.com/users/schlessera/orgs","repos_url":"https://api.github.com/users/schlessera/repos","events_url":"https://api.github.com/users/schlessera/events{/privacy}","received_events_url":"https://api.github.com/users/schlessera/received_events","type":"User","site_admin":false},"created_at":"2016-03-08T19:27:10Z","updated_at":"2016-03-08T19:27:10Z","body":"As a simple example of how to use this, you can look at one of my recent repos here: https://github.com/brightnucleus/geolite2-country/blob/master/src/DatabaseUpdater.php\r\n\r\nI wanted to have a way of automatically keeping a geolocation database up-to-date on each `composer update`. This was not possible using the script hooks, as these are only executed for the root package.\r\n\r\nAt [DatabaseUpdater.php L40-L41](https://github.com/brightnucleus/geolite2-country/blob/master/src/DatabaseUpdater.php#L40-L41) you can see that you can attach arbitrary hooks to the Composer events in this way."}}