3 [![Build Status](https://travis-ci.org/drupal-composer/drupal-scaffold.svg?branch=master)](https://travis-ci.org/drupal-composer/drupal-scaffold)
5 Composer plugin for automatically downloading Drupal scaffold files (like
6 `index.php`, `update.php`, …) when using `drupal/core` via Composer.
8 It is recommended that the vendor directory be placed in its standard location
9 at the project root, outside of the Drupal root; however, the location of the
10 vendor directory and the name of the Drupal root may be placed in whatever
11 location suits the project. Drupal-scaffold will generate the autoload.php
12 file at the Drupal root to require the Composer-generated autoload file in the
17 Run `composer require drupal-composer/drupal-scaffold:dev-master` in your composer
18 project before installing or updating `drupal/core`.
20 Once drupal-scaffold is required by your project, it will automatically update
21 your scaffold files whenever `composer update` changes the version of
22 `drupal/core` installed.
26 You can configure the plugin with providing some settings in the `extra` section
27 of your root `composer.json`.
33 "source": "http://cgit.drupalcode.org/drupal/plain/{path}?h={version}",
39 "sites/default/example.settings.my.php"
42 "sites/default/default.services.yml": "sites/default/services.yml",
43 "sites/default/default.settings.php": "sites/default/settings.php"
45 "omit-defaults": false
50 The `source` option may be used to specify the URL to download the
51 scaffold files from; the default source is drupal.org. The literal string
52 `{version}` in the `source` option is replaced with the current version of
53 Drupal core being updated prior to download.
55 With the `drupal-scaffold` option `excludes`, you can provide additional paths
56 that should not be copied or overwritten. The plugin provides no excludes by
59 Default includes are provided by the plugin:
64 .eslintrc (Drupal <= 8.2.x)
65 .eslintrc.json (Drupal >= 8.3.x)
67 .ht.router.php (Drupal >= 8.5.x)
71 sites/default/default.settings.php
72 sites/default/default.services.yml
73 sites/development.services.yml
74 sites/example.settings.local.php
75 sites/example.sites.php
80 When setting `omit-defaults` to `true`, neither the default excludes nor the
81 default includes will be provided; in this instance, only those files explicitly
82 listed in the `excludes` and `includes` options will be considered. If
83 `omit-defaults` is `false` (the default), then any items listed in `excludes`
84 or `includes` will be in addition to the usual defaults.
86 The `initial` hash lists files that should be copied over only if they do not
87 exist in the destination. The key specifies the path to the source file, and
88 the value indicates the path to the destination file.
92 When using Composer to install or update the Drupal development branch, the
93 scaffold files are always taken from the HEAD of the branch (or, more
94 specifically, from the most recent development .tar.gz archive). This might
95 not be what you want when using an old development version (e.g. when the
96 version is fixed via composer.lock). To avoid problems, always commit your
97 scaffold files to the repository any time that composer.lock is committed.
98 Note that the correct scaffold files are retrieved when using a tagged release
99 of `drupal/core` (recommended).
103 The plugin by default is only downloading the scaffold files when installing or
104 updating `drupal/core`. If you want to call it manually, you have to add the
105 command callback to the `scripts`-section of your root `composer.json`, like this:
110 "drupal-scaffold": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold"
115 After that you can manually download the scaffold files according to your
116 configuration by using `composer drupal-scaffold`.
118 It is assumed that the scaffold files will be committed to the repository, to
119 ensure that the correct files are used on the CI server (see **Limitation**,
120 above). After running `composer install` for the first time commit the scaffold
121 files to your repository.