{"id":27363,"date":"2017-02-26T11:05:37","date_gmt":"2017-02-26T09:05:37","guid":{"rendered":"https:\/\/mamchenkov.net\/wordpress\/?p=27363"},"modified":"2017-02-26T11:07:38","modified_gmt":"2017-02-26T09:07:38","slug":"composer-require-inline-alias","status":"publish","type":"post","link":"https:\/\/mamchenkov.net\/wordpress\/2017\/02\/26\/composer-require-inline-alias\/","title":{"rendered":"Composer require inline alias"},"content":{"rendered":"<!-- google_ad_section_start -->\n<p>Here&#8217;s a feature of composer that I didn&#8217;t know about until a few days ago &#8211; <a href=\"https:\/\/getcomposer.org\/doc\/articles\/aliases.md#require-inline-alias\">require inline alias<\/a>. \u00a0Here&#8217;s the example from the documentation:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n{\r\n    &quot;repositories&quot;: &#x5B;\r\n        {\r\n            &quot;type&quot;: &quot;vcs&quot;,\r\n            &quot;url&quot;: &quot;https:\/\/github.com\/you\/monolog&quot;\r\n        }\r\n    ],\r\n    &quot;require&quot;: {\r\n        &quot;symfony\/monolog-bundle&quot;: &quot;2.0&quot;,\r\n        &quot;monolog\/monolog&quot;: &quot;dev-bugfix as 1.0.x-dev&quot;\r\n    }\r\n}\r\n<\/pre>\n<p>This is super useful when you have dependencies in your project that require a particular version of a third-party library or plugin, and you want to try a branch of that library or plugin. Switching to the <a href=\"https:\/\/getcomposer.org\/doc\/articles\/aliases.md#branch-alias\">branch alias<\/a> doesn&#8217;t solve the problem, as everything that has version constraints on that requirement, will complain. With inline alias, you can alias a particular branch of the dependency as a particular version.<\/p>\n<p>With inline alias, composer will fetch the branch that you want, but will assume that that branch works as a particular version that you specify, and thus satisfy all the other dependencies that require that particular version.<\/p>\n<p>In my particular case, I was working on the <a href=\"https:\/\/cakephp.org\/\">CakePHP<\/a>-based application, which was using a few CakePHP plugins (installed via composer). \u00a0Those plugins require CakePHP v3+. \u00a0I wanted to test a branch of CakePHP which had <a href=\"https:\/\/github.com\/cakephp\/cakephp\/pull\/10257\">a particular fix<\/a> I was interested in, but without disabling all the plugins. \u00a0Switching my application&#8217;s composer to require a branch dissatisfied all the plugins, as now composer didn&#8217;t know if the branch that I am requiring is of the CakePHP v3 or not. \u00a0Aliasing the branch to <a href=\"https:\/\/github.com\/cakephp\/cakephp\/releases\/tag\/3.4.1\">v3.4.1<\/a> (current stable version at the time) worked like a charm.<\/p>\n<!-- google_ad_section_end -->\n","protected":false},"excerpt":{"rendered":"<!-- google_ad_section_start -->\n<p>Here&#8217;s a feature of composer that I didn&#8217;t know about until a few days ago &#8211; require inline alias. \u00a0Here&#8217;s the example from the documentation: { &quot;repositories&quot;: &#x5B; { &quot;type&quot;: &quot;vcs&quot;, &quot;url&quot;: &quot;https:\/\/github.com\/you\/monolog&quot; } ], &quot;require&quot;: { &quot;symfony\/monolog-bundle&quot;: &quot;2.0&quot;, &quot;monolog\/monolog&quot;: &quot;dev-bugfix as 1.0.x-dev&quot; } } This is super useful when you have dependencies in your &hellip; <a href=\"https:\/\/mamchenkov.net\/wordpress\/2017\/02\/26\/composer-require-inline-alias\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Composer require inline alias<\/span><\/a><\/p>\n<!-- google_ad_section_end -->\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"Composer require inline alias #WebDev #PHP #composer #CakePHP","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_links_to":"","_links_to_target":""},"categories":[1,18,62,1334],"tags":[1537,3489,38,1330],"keyring_services":[],"class_list":["post-27363","post","type-post","status-publish","format-standard","hentry","category-general","category-programming","category-technology","category-web-work","tag-cakephp","tag-composer","tag-php","tag-web-development"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":24687,"url":"https:\/\/mamchenkov.net\/wordpress\/2015\/08\/31\/logging-with-monolog\/","url_meta":{"origin":27363,"position":0},"title":"Logging with Monolog","author":"Leonid Mamchenkov","date":"August 31, 2015","format":false,"excerpt":"\"Logging with Monolog: From Devtools to Slack\" is a handy quick article for anybody who wants to use Monolog for logging in PHP applications. \u00a0After all, monolog\/monolog is one of the most popular libraries on Packagist.","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":28553,"url":"https:\/\/mamchenkov.net\/wordpress\/2018\/05\/07\/php-application-logging-with-amazon-cloudwatch-logs-and-monolog\/","url_meta":{"origin":27363,"position":1},"title":"PHP application logging with Amazon CloudWatch Logs and Monolog","author":"Leonid Mamchenkov","date":"May 7, 2018","format":false,"excerpt":"AWS Developer Blog ran this post a while back - \"PHP application logging with Amazon CloudWatch Logs and Monolog\", in which they show how to use Monolog and Amazon CloudWatch together in any PHP application.\u00a0 It goes beyond a basic configuration of connecting the two, all the way into setting\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2018\/05\/php-aws-500x254.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":21711,"url":"https:\/\/mamchenkov.net\/wordpress\/2014\/04\/28\/monolog-logging-for-php-5-3\/","url_meta":{"origin":27363,"position":2},"title":"Monolog &#8211; Logging for PHP 5.3+","author":"Leonid Mamchenkov","date":"April 28, 2014","format":"link","excerpt":"Monolog - Logging for PHP 5.3+","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26051,"url":"https:\/\/mamchenkov.net\/wordpress\/2016\/04\/21\/adventure-in-composer-private-repositories\/","url_meta":{"origin":27363,"position":3},"title":"Adventure in composer private repositories","author":"Leonid Mamchenkov","date":"April 21, 2016","format":false,"excerpt":"First of all, I would like to take this opportunity and wish composer a happy birthday and many more years to come. \u00a0It's been five years, and the world of PHP has changed so drastically that not many people remember how it used to be before. I would have completely\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":24303,"url":"https:\/\/mamchenkov.net\/wordpress\/2015\/06\/05\/wordpress-plugins-github-mirror\/","url_meta":{"origin":27363,"position":4},"title":"WordPress Plugins GitHub Mirror","author":"Leonid Mamchenkov","date":"June 5, 2015","format":"link","excerpt":"WordPress Plugins GitHub Mirror (or on GitHub): Say hello to fully automated GitHub mirrors of every plugin in the WordPress.org plugin repository. These aren't your typical plugin Git repositories. These mirrors can be used for fast, efficient, and automated plugin updates using Composer, and don't require \"sync scripts\" or separate\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"stats","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2015\/06\/stats-500x295.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":28325,"url":"https:\/\/mamchenkov.net\/wordpress\/2018\/01\/10\/17-tips-for-using-composer-efficiently\/","url_meta":{"origin":27363,"position":5},"title":"17 Tips for Using Composer Efficiently","author":"Leonid Mamchenkov","date":"January 10, 2018","format":false,"excerpt":"Martin Hujer has collected 17 tips for using composer efficiently, and then added a few more after receiving the feedback on the blog post.\u00a0 I was familiar with most of these, but there are still a few that are new to me. Tip #7: Run Travis CI builds with different\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/27363","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/comments?post=27363"}],"version-history":[{"count":0,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/27363\/revisions"}],"wp:attachment":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/media?parent=27363"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/categories?post=27363"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/tags?post=27363"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/keyring_services?post=27363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}