PHPackages                             drupal/core-vendor-hardening - 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. [Security](/categories/security)
4. /
5. drupal/core-vendor-hardening

ActiveComposer-plugin[Security](/categories/security)

drupal/core-vendor-hardening
============================

Hardens the vendor directory for when it's in the docroot.

11.3.5(9mo ago)174.5M↑18.1%1[1 issues](https://github.com/drupal/core-vendor-hardening/issues)[1 PRs](https://github.com/drupal/core-vendor-hardening/pulls)20GPL-2.0-or-laterPHPPHP &gt;=7.3.0

Since Oct 14Pushed 1mo ago6 watchersCompare

[ Source](https://github.com/drupal/core-vendor-hardening)[ Packagist](https://packagist.org/packages/drupal/core-vendor-hardening)[ Docs](https://www.drupal.org/project/drupal)[ RSS](/packages/drupal-core-vendor-hardening/feed)WikiDiscussions 11.x Synced 1mo ago

READMEChangelogDependencies (1)Versions (349)Used By (20)

```
The Drupal Vendor Hardening Composer Plugin
===========================================

Thanks for using this Drupal component.

You can participate in its development on Drupal.org, through our issue system:
https://www.drupal.org/project/issues/drupal

You can get the full Drupal repo here:
https://www.drupal.org/project/drupal/git-instructions

You can browse the full Drupal repo here:
https://git.drupalcode.org/project/drupal

What does it do?
----------------

This Composer plugin does two things:

1) It removes extraneous directories from the project's vendor directory.
They're typically directories which might contain executable files, such as test
directories.

This sort of processing is required for projects that have a vendor directory
inside the HTTP server docroot. This is a common layout for Drupal.

By default, the plugin knows how to clean up packages for Drupal core, so you
can require drupal/core-vendor-hardening in your project and the rest will
happen automatically.

The plugin can also be configured to clean up additional packages using the
project's composer.json extra field.

This plugin can also clean up packages that were installed outside of the
vendor directory, using composer/installers. This allows users to configure the
plugin to clean up, for instance, Drupal extensions and Drupal core.

2) The plugin also adds .htaccess file to the root of the
project's vendor directory. The file will perform due diligence to keep the
web server from serving file from within the vendor directory.

How do I set it up?
-------------------

Require this Composer plugin into your project:

    composer require drupal/core-vendor-hardening

When you install or update, this plugin will look through each package and
remove directories it knows about.

You can see the list of default package cleanups for this plugin in Config.php.
If you discover that this list needs updating, file an issue about it:
https://www.drupal.org/project/issues/drupal

In addition to the default list of packages, you can configure the plugin using
the root package's composer.json extra field, like this:

    "extra": {
      "drupal-core-vendor-hardening": {
        "vendor/package": ["test", "documentation"]
      }
    }

The above code will tell the plugin to remove the test/ and documentation/
directories from the 'vendor/package' package when it is installed or updated.

For packages installed outside of the vendor directory, such as those installed
by composer/installers, the paths to remove should be relative to the package
base. As an example, a Drupal module package named drupal/module_name might be
installed by composer/installers to web/modules/contrib/module_name/. Cleanup
paths specified for this package might look like this:

    "extra": {
      "drupal-core-vendor-hardening": {
        "drupal/module_name": ["tests", "src/Tests"]
      }
    }

This would then cause the plugin to try and remove
web/modules/contrib/module_name/tests and
web/modules/contrib/module_name/src/Tests.

The plugin can be configured to NOT clean certain packages. This is not
recommended, but it may be useful for advanced use cases, such as allowing
Drupal to use a copy of Composer installed locally in the project. For
example, to prevent the plugin from cleaning `composer/composer`:

    "extra": {
      "drupal-core-vendor-hardening": {
        "composer/composer": false
      }
    }
```

###  Health Score

60

—

FairBetter than 99% of packages

Maintenance74

Regular maintenance activity

Popularity51

Moderate usage in the ecosystem

Community28

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 72.7% 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 ~7 days

Recently: every ~37 days

Total

348

Last Release

131d ago

Major Versions

9.3.10 → 10.0.0-alpha52022-03-31

9.5.3 → 10.2.22023-07-24

10.3.0 → 11.0.0-alpha12024-04-14

10.3.4 → 11.1.32024-11-11

10.4.0-rc1 → 11.2.02025-03-03

PHP version history (2 changes)8.8.0-alpha1PHP &gt;=7.0.8

9.0.0-alpha1PHP &gt;=7.3.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/27288432?v=4)[Drupal Infrastructure](/maintainers/Drupal-Infrastructure)[@Drupal-Infrastructure](https://github.com/Drupal-Infrastructure)

---

Top Contributors

[![alexpott](https://avatars.githubusercontent.com/u/769634?v=4)](https://github.com/alexpott "alexpott (16 commits)")[![larowlan](https://avatars.githubusercontent.com/u/555254?v=4)](https://github.com/larowlan "larowlan (3 commits)")[![goba](https://avatars.githubusercontent.com/u/235185?v=4)](https://github.com/goba "goba (1 commits)")[![longwave](https://avatars.githubusercontent.com/u/197817?v=4)](https://github.com/longwave "longwave (1 commits)")[![xjm](https://avatars.githubusercontent.com/u/1369057?v=4)](https://github.com/xjm "xjm (1 commits)")

---

Tags

drupal

### Embed Badge

![Health badge](/badges/drupal-core-vendor-hardening/health.svg)

```
[![Health](https://phpackages.com/badges/drupal-core-vendor-hardening/health.svg)](https://phpackages.com/packages/drupal-core-vendor-hardening)
```

###  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)[mxr576/ddqg-composer-audit

Drupal Dependency Quality Gate Composer Audit plugin

1056.7k2](/packages/mxr576-ddqg-composer-audit)[plan2net/typo3-update-check

A Composer plugin that checks for TYPO3 updates and provides detailed information about breaking changes and security updates

204.5k](/packages/plan2net-typo3-update-check)

PHPackages © 2026

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