PHPackages                             hussainweb/drupal-composer-helper - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. hussainweb/drupal-composer-helper

ActiveComposer-plugin[Utility &amp; Helpers](/categories/utility)

hussainweb/drupal-composer-helper
=================================

Common scripts used with Drupal

v1.0.0-beta7(6y ago)5102.3k—10%1[1 issues](https://github.com/hussainweb/drupal-composer-helper/issues)2MITPHPPHP &gt;=5.5.9

Since Oct 9Pushed 6y ago1 watchersCompare

[ Source](https://github.com/hussainweb/drupal-composer-helper)[ Packagist](https://packagist.org/packages/hussainweb/drupal-composer-helper)[ RSS](/packages/hussainweb-drupal-composer-helper/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (6)Versions (8)Used By (2)

drupal-composer-helper
======================

[](#drupal-composer-helper)

[![Latest Version](https://camo.githubusercontent.com/0fa04384c7dd8c13feaabfb52de9cca3d4377943b37daefe0bd34351bf2b194d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6875737361696e7765622f64727570616c2d636f6d706f7365722d68656c7065722f616c6c2e7376673f7374796c653d666c61742d737175617265)](https://github.com/hussainweb/drupal-composer-helper/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/9615cdeb6b10fd24adea3838e18e74a0ba20899b2f8825658f9420b949c16db4/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6875737361696e7765622f64727570616c2d636f6d706f7365722d68656c7065722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/hussainweb/drupal-composer-helper)[![Total Downloads](https://camo.githubusercontent.com/2e562e2d136a40c07d6b0b3e2852e7c832fcc35ef1dea33ba7a9e148fc5bc118/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6875737361696e7765622f64727570616c2d636f6d706f7365722d68656c7065722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/hussainweb/drupal-composer-helper)

This plugin handles common operations for composer based Drupal setups. The code in this plugin is derived from the Drupal code base itself and also other projects such as [drupal-composer/drupal-project](https://github.com/drupal-composer/drupal-project).

Why?
----

[](#why)

The motive behind writing this plugin was to make a Drupal composer based setup more maintainable. It is easy to start with the template provided by [drupal-composer/drupal-project](https://github.com/drupal-composer/drupal-project) but upgrading it is difficult. The plugin solves that problem by keeping all the code outside your project and in the plugin which would make upgrading as easy as running `composer update`.

Installation
------------

[](#installation)

If you are starting off a new Drupal 7 or 8 website, it is easier to start with the [hussainweb/drupal-composer-init](https://github.com/hussainweb/drupal-composer-init) composer plugin. Follow the instructions there to install and use the command. The [composer.json files generated](https://gist.github.com/hussainweb/78c0a5fe45556c265b16e10928b76723) include this plugin.

For existing composer setups, just run this command:

```
composer require hussainweb/drupal-composer-helper:^1.0

```

### Usage with the new composer template

[](#usage-with-the-new-composer-template)

*TODO*

### Usage in drupal-composer template

[](#usage-in-drupal-composer-template)

This plugin includes most of the functionality from drupal-composer template. That said, the plugin can be used in the template with some changes. The changes are not necessary to run the plugin but some operations could run twice.

Follow these steps to use the plugin in drupal-composer template:

- Include the plugin: `composer require hussainweb/drupal-composer-helper:~1.0`
- Remove `'DrupalProject\\composer\\ScriptHandler::createRequiredFiles'` from `post-install-cmd` and `post-update-cmd` in `scripts` section of your composer.json. The plugin creates all necessary files.
- (Optional) After the above changes, you may remove `scripts/composer/ScriptHandler.php` file entirely (if you have not made any changes) and remove any references from the composer.json. There are some references in the `autoload` section, and also in `pre-install-cmd` and `post-install-cmd` scripts. This functionality is not present in the plugin but it is not really necessary as it is just a version check for composer.
- (Optional) If you have not changed any paths in `installer-paths` section from `extra` section in your `composer.json`, you may remove them. The plugin sets defaults which match the defaults set by the template. The paths in this section will take precedence over the plugin defaults.

Configuration
-------------

[](#configuration)

The plugin provides following configuration options (and defaults) in `composer.json` file:

```
{
    ...
    "extra": {
        "drupal-composer-helper": {
            "set-d7-paths": false
        },
        ...
    },
    ...

```

### Drupal Path

[](#drupal-path)

This plugin finds the path to Drupal installation using the new setting provided by the new [core Drupal scaffold plugin](https://packagist.org/packages/drupal/core-composer-scaffold). It uses this as a prefix to set all the Drupal relevant installer paths so that Drupal core, modules, and themes may be installed in the correct location. The plugin also runs scaffolding within this directory and creates other required files for Drupal.

Example:

```
{
    ...
    "extra": {
        "drupal-scaffold": {
            "locations: {
                "web-root": "web/"
            }
        },
        "drupal-composer-helper": {
            "additional-cleanup": [],
            "set-d7-paths": false
        },
        ...
    },
    ...

```

For a Drupal 8 setup, the defaults set by this plugin are as follows:

```
'core': 'web/core/',
'module': 'web/modules/contrib/{$name}/',
'theme': 'web/themes/contrib/{$name}/',
'library': 'web/libraries/{$name}/',
'profile': 'web/profiles/contrib/{$name}/',
'drush': 'drush/{$name}/',
'custom-theme': 'web/themes/custom/{$name}/',
'custom-module': 'web/modules/custom/{$name}/',

```

The above are just defaults and can be overridden by the usual `installer-paths` property in `extra` section in your composer.json file.

### drupal-web-dir *(deprecated)*

[](#drupal-web-dir-deprecated)

Default: 'web'

This setting is deprecated in favour of [core's Drupal scaffold plugin settings](#drupal-path) setting. The plugin still falls back to this setting if that is not set but for compatibility with the rest of the Drupal ecosystem, it is a good idea to use the new setting.

### web-prefix *(deprecated)*

[](#web-prefix-deprecated)

Default: 'web'

This setting is deprecated in favour of [core's Drupal scaffold plugin settings](#drupal-path) setting. The plugin still falls back to this setting if that is not set but for compatibility with the rest of the Drupal ecosystem, it is a good idea to use the new setting.

See also: `set-d7-paths`.

### additional-cleanup *(removed)*

[](#additional-cleanup-removed)

Default: Empty array

This has been replaced by the functionality in [`drupal/core-vendor-hardening`](https://packagist.org/packages/drupal/core-vendor-hardening). You still need to explicitly require that plugin in your composer.json. The plugin only suggests adding it.

### set-d7-paths

[](#set-d7-paths)

Default: false

Set this to `true` if you are building a Drupal 7 based site. This configuration option changes the default `installer-paths` paths to Drupal 7 typical paths.

If your `web-prefix` is `docroot`, the `installer-paths` set if this option is `true` are as follows.

```
'core': 'docroot/',
'module': 'docroot/sites/all/modules/contrib/{$name}/',
'theme': 'docroot/sites/all/themes/contrib/{$name}/',
'library': 'docroot/sites/all/libraries/{$name}/',
'profile': 'docroot/sites/all/profiles/contrib/{$name}/',
'drush': 'drush/{$name}/',
'custom-theme': 'docroot/sites/all/themes/custom/{$name}/',
'custom-module': 'docroot/sites/all/modules/custom/{$name}/',

```

Contributing
------------

[](#contributing)

Contributions are welcome. Please use the issue queue to describe the problem. Pull requests are welcome.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~142 days

Recently: every ~212 days

Total

7

Last Release

2289d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/085aa457eb46e449e7045c81d904cb31e53009485f8926af78651ca6e0676fcb?d=identicon)[hussainweb](/maintainers/hussainweb)

---

Top Contributors

[![hussainweb](https://avatars.githubusercontent.com/u/1040271?v=4)](https://github.com/hussainweb "hussainweb (50 commits)")

---

Tags

composercomposer-plugindrupaldrupal-7drupal-8drupal

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/hussainweb-drupal-composer-helper/health.svg)

```
[![Health](https://phpackages.com/badges/hussainweb-drupal-composer-helper/health.svg)](https://phpackages.com/packages/hussainweb-drupal-composer-helper)
```

###  Alternatives

[drupal/core-composer-scaffold

A flexible Composer project scaffold builder.

5341.9M446](/packages/drupal-core-composer-scaffold)[drupal/core-project-message

Adds a message after Composer installation.

2122.6M172](/packages/drupal-core-project-message)[acquia/drupal-recommended-settings

The composer plugin for adding drupal-recommended-settings for Acquia Cloud.

101.1M4](/packages/acquia-drupal-recommended-settings)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
