Composer
Composer.json
The composer.json
file of a project using Sobki should have the
following content, in addition to other content specific to the project:
{
"require": {
"composer/installers": "^2.0",
"cweagans/composer-patches": "^1.0",
"oomphinc/composer-installers-extender": "^2.0"
},
"repositories": {
"asset-packagist": {
"type": "composer",
"url": "https://asset-packagist.org"
},
"drupal": {
"type": "composer",
"url": "https://packages.drupal.org/8"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"composer-exit-on-patch-failure": true,
"drupal-scaffold": {
"file-mapping": {
"[web-root]/robots.txt": false
},
"locations": {
"web-root": "./app"
}
},
"enable-patching": true,
"installer-paths": {
"app/core": [
"type:drupal-core"
],
"app/libraries/fontawesome": [
"npm-asset/fortawesome--fontawesome-free"
],
"app/libraries/{$name}": [
"type:drupal-library",
"type:bower-asset",
"type:npm-asset"
],
"app/modules/contrib/{$name}": [
"type:drupal-module"
],
"app/modules/custom/{$name}": [
"type:drupal-custom-module"
],
"app/profiles/contrib/{$name}": [
"type:drupal-profile"
],
"app/profiles/custom/{$name}": [
"type:drupal-custom-profile"
],
"app/themes/contrib/{$name}": [
"type:drupal-theme"
],
"app/themes/custom/{$name}": [
"type:drupal-custom-theme"
],
"drush/Commands/contrib/{$name}": [
"type:drupal-drush"
]
},
"installer-types": [
"bower-asset",
"npm-asset"
],
"patchLevel": {
"drupal/core": "-p2"
}
}
}
In the previous example, app
is the root folder of Drupal. The name can have a
different value.
See Drupal.org documentation for detailed explanations.
Asset Packagist
To retrieve non-PHP libraries, we use Asset Packagist.
If you do not want to use Asset Packagist, you can declare the packages manually following Composer documentation.
Other Composer packages
There are other Composer packages not mandatory for Sobki, but these may be useful.
Drupal Localization: To use Composer to download Drupal contrib translations.
Drupal Paranoia: To provide an additional security layer.