The "drupal/core-composer-scaffold" is a composer plugin designed to manage scaffold files from the drupal/core
project and place them inside the web root. These scaffold files include individual asset files like index.php
, update.php
, and others. The primary benefit of managing these files is that it allows Drupal sites to be fully managed using Composer while still allowing individual asset files to be placed in arbitrary locations. This arrangement makes it possible for a properly configured composer template to generate a file layout that exactly mirrors that of a Drupal 8.7.x and earlier tarball distribution.
To utilize the drupal/core-composer-scaffold
, you must require it in your project and provide the necessary configuration settings in the extra
section of your project's composer.json file. These settings include parameters like the location of your web root and the packages permitted to scaffold files. Once the necessary parameters are set, the scaffold operations run automatically following a composer install
command.
Here is an example of how you might use this project in your composer.json file:
{
"name": "my/project",
"require": {
"drupal/core-composer-scaffold": "*",
},
"extra": {
"drupal-scaffold": {
"locations": {
"web-root": "./docroot"
},
"allowed-packages": [
"upstream/project"
]
}
}
}
To scaffold files directly, you can run the command composer drupal:scaffold
.
The detailed documentation for drupal/core-composer-scaffold
, including detailed configuration details and various use case examples, can be found embedded in the readme file of the project's GitHub repository drupal/core-composer-scaffold. The documentation covers areas like defining project locations, altering scaffold files, defining scaffold files, and more, providing users with the necessary guidance to fully utilize the composer package.