PHPackages                             deminy/composer-preserve-paths - 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. deminy/composer-preserve-paths

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

deminy/composer-preserve-paths
==============================

Composer plugin for preserving custom paths and supporting nested packages

0.1.4(9y ago)013.7k1GPL-2.0+PHP

Since Feb 3Pushed 9y ago1 watchersCompare

[ Source](https://github.com/deminy/composer-preserve-paths)[ Packagist](https://packagist.org/packages/deminy/composer-preserve-paths)[ Docs](https://github.com/deminy/composer-preserve-paths)[ RSS](/packages/deminy-composer-preserve-paths/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

Composer preserve paths
=======================

[](#composer-preserve-paths)

[![Build Status](https://camo.githubusercontent.com/abc2de9695c22a525d6a033b5946d4ee529a8384cdb0ba0b3958c917f2513777/68747470733a2f2f7472617669732d63692e6f72672f64656d696e792f636f6d706f7365722d70726573657276652d70617468732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/deminy/composer-preserve-paths)[![HHVM Status](https://camo.githubusercontent.com/620a260d41485a18b7ac520f53fbeaa78780a7eff4f8b888755d23c374fb8f76/687474703a2f2f6868766d2e683463632e64652f62616467652f64656d696e792f636f6d706f7365722d70726573657276652d70617468732e737667)](http://hhvm.h4cc.de/package/deminy/composer-preserve-paths)[![Latest Stable Version](https://camo.githubusercontent.com/43c3824699b30cf212be417e86a0e32fc61218e75805df45eddfa186c5b4cb21/68747470733a2f2f706f7365722e707567782e6f72672f64656d696e792f636f6d706f7365722d70726573657276652d70617468732f762f737461626c652e737667)](https://packagist.org/packages/deminy/composer-preserve-paths)[![Latest Unstable Version](https://camo.githubusercontent.com/0e850c1b23c1b4ce3f322a1fbf09edba8ec6ee14d09d7478e9e4ee149b0093f4/68747470733a2f2f706f7365722e707567782e6f72672f64656d696e792f636f6d706f7365722d70726573657276652d70617468732f762f756e737461626c652e737667)](https://packagist.org/packages/deminy/composer-preserve-paths)[![License](https://camo.githubusercontent.com/c33b2b06dbd6da525d9107cd165bddeb268a0334d0775cd218ef36be99d7960e/68747470733a2f2f706f7365722e707567782e6f72672f64656d696e792f636f6d706f7365722d70726573657276652d70617468732f6c6963656e73652e737667)](https://packagist.org/packages/deminy/composer-preserve-paths)

Composer plugin for preserving paths while installing, updating or uninstalling packages.

This way you can:

- provide custom files or directories that will not be overwritten on `composer install` or `composer update`
- place packages within the directory of another package (using a composer installer like [composer/installers](https://packagist.org/packages/composer/installers) or [davidbarratt/custom-installer](https://packagist.org/packages/davidbarratt/custom-installer))

This plugin was originally developed by [Johannes Haseitl](https://github.com/derhasi/composer-preserve-paths). I updated it to allow wildcard pattern matching when defining preserved paths, which is necessary if you have many sites installed with same Drupal installation (i.e., you have many directories like *example.com*, *example.net*, *example.org*, etc under folder *sites/* of your Drupal installation).

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

[](#installation)

Simply install the plugin with composer: `composer require deminy/composer-preserve-paths`

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

[](#configuration)

For configuring the paths you need to set `preserve-paths` within the `extra` of your root `composer.json`.

```
{
    "extra": {
        "preserve-paths": [
          "htdocs/sites/all/modules/contrib",
          "htdocs/sites/all/themes/contrib",
          "htdocs/sites/all/libraries",
          "htdocs/sites/all/drush",
          "htdocs/sites/*.com",
          "htdocs/sites/*.net",
          "htdocs/sites/*.org"
        ]
      }
}
```

Example
-------

[](#example)

An example composer.json using [davidbarratt/custom-installer](https://packagist.org/packages/davidbarratt/custom-installer):

```
{
  "repositories": [
    {
      "type": "composer",
      "url": "https://packagist.drupal-composer.org/"
    }
  ],
  "require": {
    "davidbarratt/custom-installer": "dev-master",
    "deminy/composer-preserve-paths": "dev-master",
    "drupal/views": "7.*",
    "drupal/drupal": "7.*"
  },
  "config": {
    "vendor-dir": "vendor"
  },
  "extra": {
    "custom-installer": {
      "drupal-module":  "htdocs/sites/all/modules/contrib/{$name}/",
      "drupal-theme":   "htdocs/sites/all/themes/contrib/{$name}/",
      "drupal-library": "htdocs/sites/all/libraries/{$name}/",
      "drupal-drush":   "htdocs/sites/all/drush/{$name}/",
      "drupal-profile": "htdocs/profiles/{$name}/",
      "drupal-core":    "htdocs/"
    },
    "preserve-paths": [
      "htdocs/sites/all/modules/contrib",
      "htdocs/sites/all/themes/contrib",
      "htdocs/sites/all/libraries",
      "htdocs/sites/all/drush",
      "htdocs/sites/*.com",
      "htdocs/sites/*.net",
      "htdocs/sites/*.org"
    ]
  }
}
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 69.8% 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

Unknown

Total

1

Last Release

3384d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/865547?v=4)[Demin Yin](/maintainers/deminy)[@deminy](https://github.com/deminy)

---

Top Contributors

[![derhasi](https://avatars.githubusercontent.com/u/118502?v=4)](https://github.com/derhasi "derhasi (37 commits)")[![deminy](https://avatars.githubusercontent.com/u/865547?v=4)](https://github.com/deminy "deminy (10 commits)")[![bnchdrff](https://avatars.githubusercontent.com/u/99194?v=4)](https://github.com/bnchdrff "bnchdrff (2 commits)")[![markpavlitski](https://avatars.githubusercontent.com/u/3777070?v=4)](https://github.com/markpavlitski "markpavlitski (2 commits)")[![NickDickinsonWilde](https://avatars.githubusercontent.com/u/92694?v=4)](https://github.com/NickDickinsonWilde "NickDickinsonWilde (1 commits)")[![webflo](https://avatars.githubusercontent.com/u/123946?v=4)](https://github.com/webflo "webflo (1 commits)")

---

Tags

installercomposer-plugincustom pathnested package

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/deminy-composer-preserve-paths/health.svg)

```
[![Health](https://phpackages.com/badges/deminy-composer-preserve-paths/health.svg)](https://phpackages.com/packages/deminy-composer-preserve-paths)
```

###  Alternatives

[drupal-composer/preserve-paths

Composer plugin for preserving custom paths and supporting nested packages

271.1M5](/packages/drupal-composer-preserve-paths)[vaimo/composer-patches

Applies a patch from a local or remote file to any package that is part of a given composer project. Patches can be defined both on project and on package level. Optional support for patch versioning, sequencing, custom patch applier configuration and patch command for testing/troubleshooting added patches.

2994.3M15](/packages/vaimo-composer-patches)[mnsami/composer-custom-directory-installer

A composer plugin, to help install packages of different types in custom paths.

1395.0M52](/packages/mnsami-composer-custom-directory-installer)[typo3/cms-composer-installers

TYPO3 CMS Installers

6113.7M52](/packages/typo3-cms-composer-installers)[typisttech/imposter-plugin

Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins.

158251.0k2](/packages/typisttech-imposter-plugin)[craftcms/plugin-installer

Craft CMS Plugin Installer

283.3M4](/packages/craftcms-plugin-installer)

PHPackages © 2026

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