Managing dependencies for a custom project is not hosted on Packagist or Drupal.org
Since starting from Drupal v8.8.0 has removed the Wikimedia merge plugin and replaced it with a Composer 'path' repository, a native Composer feature which serves the same needs as the merge plugin with fewer disadvantages, in this short article, I want to show how to manage dependencies for a custom project.
Create composer.json file with a similar code:
{
"name": "mypackage/custom_module",
"description": "The description of my module.",
"type": "drupal-custom-module",
"homepage": "https://makedrupaleasy.com",
"authors": [
{
"name": "Ruslan P",
"homepage": "https://www.drupal.org/u/ruslanp",
"role": "Maintainer"
},
],
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"preferred-install": "dist"
},
"require": {
"symfony/dom-crawler": "^4.0",
"symfony/css-selector": "^4.0"
}
}
Find the repositories section of your root composer.json file, and modify it to include your custom module or modules as path repositories:
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
},
{
"type": "path",
"url": "docroot/modules/custom/custom_module"
}
]
Next, require your module in your project: composer require mypackage/custom_module
Done!
Related links:
- Stop using wikimedia/composer-merge-plugin
- Add a composer.json file
- Managing dependencies for a custom project