PHPackages                             xwp/composer-isolator - 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. xwp/composer-isolator

ActiveComposer-plugin

xwp/composer-isolator
=====================

Composer plugin to isolate project dependencies by prefixing their namespace

2.0.0(5y ago)10101MITPHPPHP ^5.6|^7.0

Since Feb 22Pushed 4y agoCompare

[ Source](https://github.com/xwp/composer-isolator)[ Packagist](https://packagist.org/packages/xwp/composer-isolator)[ Docs](https://github.com/xwp/composer-isolator)[ RSS](/packages/xwp-composer-isolator/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (5)Versions (6)Used By (0)

Composer Isolator
=================

[](#composer-isolator)

[![Lint and Test](https://github.com/xwp/composer-isolation/actions/workflows/ci.yml/badge.svg)](https://github.com/xwp/composer-isolation/actions/workflows/ci.yml)

**Composer plugin to isolate project dependencies by prefixing their namespace.**

---

How it Works
------------

[](#how-it-works)

This plugin prefixes all vendor namespaces with a chosen value. This includes all declared namespaces, use statements, fully qualified references, and most string values that reference the namespace.

All vendor code and composer autoload mappings are updated to reference the prefixed namespace.

### What it does *not* do

[](#what-it-does-not-do)

It will not touch any code in your project. It only affects code in the vendor directory, and it only affects code referencing the affected namespaces. You must update all references in your code yourself if you apply this to an existing project.

### Why use it

[](#why-use-it)

This plugin allows you to run two projects that utilize composer dependencies in the same runtime, without worrying about conflicting dependencies. The most common example is in a WordPress environment, where all plugins execute in the same runtime, and may rely on the same composer dependencies. Each project utilizing the plugin can't conflict with any other project unless the vendor code is not namespaced (in which case there aren't many options...).

Known Limitations
-----------------

[](#known-limitations)

- It doesn't replace function definitions and calls in the global namespace. Any definitions and calls to global functions will remain in the global namespace after the transformation.

Usage
-----

[](#usage)

Using the plugin is straightforward. Install the plugin by requiring it in your project: `composer require and/isolate-composer`.

Configure the plugin by adding the following to your `composer.json`:

```
"config" : {
    "isolate": {
      "prefix": "Your\\Prefix\\Here\\",
      "excludelist": [],
      "autorun": false,
      "require-dev": false,
      "replacements" : {}
    }
}

```

The only required value is the `prefix`.

After you have configured the plugin, run the isolation:

```
composer isolate
composer dump

```

Your vendor code is now prefixed!

Be sure to `dump` after you `isolate`, or your autoload mappings will be incorrect!

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

[](#configuration)

**prefix**

This is the value that will be prepended to all vendor namespaces. It should be a valid namespace, and should be unique to your project. I recommend you don't use your main project namespace, or at least add `\\Vendor` to the end.

**exludelist**

This is a list of packages you don't want to prefix. Matching packages will not be scanned for namespaces, but will still have code rewritten if it contains namespaces from other non-excluded packages.

**autorun**

Setting this value to true automatically runs the isolation process before every `dump`.

**require-dev**

By default, only `require` packages are scanned for namespaces, and `require-dev` packages are ignored (as above, they will still have code rewritten if they contain namespaces from other packages).

Setting this value to `true` includes the `require-dev` packages in the scan, and any found namespaces will be prefixed.

**replacements**

This is a place for manually fixing things in the vendor code that either were not detected and replaced, or replaced when they should not have been.

After each file has been parsed and rewritten, if there is an entry in the replacements list, it will do a string replace on the file.

String replacements should be idempotent, or things will break on multiple executions.

The syntax is:

```
"replacements" : {
    "path/relative/to/vendor/root/file.php" : {
        "search" : "replace",
        "search" : "replace",
    },
    "path/relative/to/vendor/root/file.php" : {
            "search" : "replace",
            "search" : "replace",
        }
}

```

Credits
-------

[](#credits)

Created and maintaned by [XWP](https://xwp.co) as a fork of [and/composer-isolation](https://github.com/logical-and/composer-isolation).

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

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

Total

5

Last Release

1836d ago

Major Versions

v1.2.x-dev → 2.0.02021-05-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/92bfcd3a8c3a21a033a6484d32c25a40b113ec6891f674336081513d5c98ef76?d=identicon)[kasparsd](/maintainers/kasparsd)

![](https://www.gravatar.com/avatar/415bc53586018077324af64dad074bf430ba1b72471550489372668274a13b12?d=identicon)[xwp](/maintainers/xwp)

---

Top Contributors

[![kasparsd](https://avatars.githubusercontent.com/u/169055?v=4)](https://github.com/kasparsd "kasparsd (34 commits)")[![logical-and](https://avatars.githubusercontent.com/u/1403109?v=4)](https://github.com/logical-and "logical-and (7 commits)")

---

Tags

composercomposer-packagecomposer-pluginwordpress

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/xwp-composer-isolator/health.svg)

```
[![Health](https://phpackages.com/badges/xwp-composer-isolator/health.svg)](https://phpackages.com/packages/xwp-composer-isolator)
```

###  Alternatives

[psy/psysh

An interactive shell for modern PHP.

9.8k545.6M719](/packages/psy-psysh)[zircote/swagger-php

Generate interactive documentation for your RESTful API using PHP attributes (preferred) or PHPDoc annotations

5.3k132.9M468](/packages/zircote-swagger-php)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[behat/behat

Scenario-oriented BDD framework for PHP

4.0k96.8M2.0k](/packages/behat-behat)[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M568](/packages/symfony-maker-bundle)[infection/infection

Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to measure the effectiveness of a test set in terms of its ability to detect faults.

2.2k26.2M1.8k](/packages/infection-infection)

PHPackages © 2026

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