davidbarratt / drupal-structure
Giving Drupal 6 & 7 a Directory Sturcture like Drupal 8 via Composer
Installs: 243
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/davidbarratt/drupal-structure
Requires
- symfony/filesystem: ~2.0
- symfony/finder: ~2.0
Requires (Dev)
- composer/composer: 1.0.*@alpha
This package is auto-updated.
Last update: 2025-10-12 03:14:33 UTC
README
Giving Drupal 6 & 7 a Directory Sturcture like Drupal 8 via Composer
This script does the following tasks when Composer install and update is run:
- Creates the folders
libraries,modules,themes, andsitesin theroot - Copies
core/sites/README.txtandcore/sites/example.sites.phptosites - Copies
core/sites/default/default.settings.phptosites/default/default.settings.php - Removes each folder in
core/sitesthat is present insites - Creates a symbolic link for each site from
core/sitestosites - Copies
core/sites/all/modules/README.txttomodules/README.txt - Copies
core/sites/all/themes/README.txttothemes/README.txt - Create symbolic link from
core/sites/all/modulestomodules - Create symbolic link from
core/sites/all/themestothemes - Create symbolic link from
core/sites/all/librariestolibraries - Create
sites/sites.phpif the file doesn’t already exist - Create symbolic link from
core/sites/sites.phptosites/sites.php
Installation
Require this library in your composer.json file
{ "require": { "davidbarratt/drupal-structure": "1.0.*@alpha", } }
Add the scripts
{ "scripts": { "post-install-cmd": [ "DavidBarratt\\DrupalStructure\\ScriptHandler::postUpdate" ], "post-update-cmd": [ "DavidBarratt\\DrupalStructure\\ScriptHandler::postUpdate" ] } }
Configuration
By default, the script assumes that Drupal core is located in the core directory and the resources (modules, themes, etc.) are located in the same directory as your composer.json file.
However, if you’d like to customize this, you can simply add the parameters in the extra. Here are the defaults (which are not necessary to add):
{ "extra": { "drupal-structure": { "root": "", "core": "core" } } }
Usage
You can use this script by simply executing composer install or composer update. Composer will execute the script when the process is finished.
Example
Here is a more practical example of how you might use this script in a real composer.json file. This setup assumes that the web root is core. However, you could copy index.php and .htaccess and alter them to fit your needs.
{ "repositories": [ { "type": "composer", "url": "http://static.drupal-packagist.org/v0.2.0/" } ], "require": { "mnsami/composer-custom-directory-installer": "1.0.*", "drupal/drupal": "~7.0", "davidbarratt/drupal-structure": "1.0.*@alpha" }, "extra": { "installer-paths":{ "core/": ["drupal/drupal"] } }, "scripts": { "post-install-cmd": [ "DavidBarratt\\DrupalStructure\\ScriptHandler::postUpdate" ], "post-update-cmd": [ "DavidBarratt\\DrupalStructure\\ScriptHandler::postUpdate" ] } }
For a more complicated example, please see: https://github.com/davidbarratt/drupal7/blob/master/composer.json