PHPackages                             x3p0-dev/x3p0-prelude - 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. x3p0-dev/x3p0-prelude

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

x3p0-dev/x3p0-prelude
=====================

Composer package prefixer — copies vendor packages and applies namespace prefixing to avoid conflicts across multiple projects.

07PHP

Since Jun 15Pushed 1mo agoCompare

[ Source](https://github.com/x3p0-dev/x3p0-prelude)[ Packagist](https://packagist.org/packages/x3p0-dev/x3p0-prelude)[ RSS](/packages/x3p0-dev-x3p0-prelude/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

X3P0 Prelude
============

[](#x3p0-prelude)

A Composer script that copies vendor packages into your project and rewrites their namespaces, preventing conflicts when the same package is used across multiple projects in the same WordPress installation.

Requirements
------------

[](#requirements)

- PHP 8.1+
- Composer 2.0+

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

[](#installation)

```
composer require-dev x3p0-dev/x3p0-prelude
```

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

[](#configuration)

Add an `x3p0.prelude` block to the `extra` section of your `composer.json`, then register the script entry point:

```
{
	"scripts": {
		"post-install-cmd": [
			"@x3p0-prelude"
		],
		"post-update-cmd": [
			"@x3p0-prelude"
		],
		"x3p0-prelude": "X3P0\\Prelude\\Compose::run"
	},
	"extra": {
		"x3p0": {
			"prelude": {
				"prefix": "MyProject\\Vendor",
				"output-path": "packages",
				"packages": {
					"vendor/package-name": {
						"replace": "OriginalNamespace\\"
					}
				}
			}
		}
	}
}
```

### Options

[](#options)

KeyRequiredDescription`prefix`YesThe namespace prefix to apply to all copied packages.`output-path`YesDirectory to copy packages into, relative to your project root.`packages`YesMap of packages to copy, keyed by `vendor/package` path.### Package options

[](#package-options)

Each entry under `packages` is keyed by the `vendor/package` path as it appears in your `vendor/` directory. Glob-style wildcards are supported.

KeyRequiredDescription`replace`NoThe original namespace root to rewrite. If omitted, files are copied without modification.### Wildcards

[](#wildcards)

Use `*` within a package key to match multiple packages under a vendor:

```
"packages": {
	"some-vendor/*": {
		"replace": "SomeVendor\\"
	}
}
```

Use `"*"` alone to match all remaining packages in `vendor/`:

```
"packages": {
	"my-vendor/specific-package": {
		"replace": "SpecificNS\\"
	},
	"*": {}
}
```

How it works
------------

[](#how-it-works)

When the script runs, it:

1. Clears the output directory.
2. Copies each configured package from `vendor/` into the output directory.
3. Rewrites every occurrence of the original namespace root in copied PHP files, prepending your `prefix`.

For example, with `prefix` set to `MyProject` and `replace` set to `X3P0\\`, a copied file containing `X3P0\Framework\Container` becomes `MyProject\Framework\Container`.

Autoloading the output
----------------------

[](#autoloading-the-output)

Register the copied packages in your `autoload` block. The exact approach depends on the package structure; a classmap is the simplest option:

```
"autoload": {
	"classmap": ["packages/"]
}
```

Or use PSR-4 if the package has a known `src/` layout:

```
"autoload": {
	"psr-4": {
		"MyProject\\Framework\\": "packages/vendor/package/src/"
	}
}
```

License
-------

[](#license)

GPL-3.0-or-later.

###  Health Score

21

—

LowBetter than 17% of packages

Maintenance61

Regular maintenance activity

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/ef868a4b45ef0263f49361744b8bb04e8f3cfcb8f3f79b274fc62823115ee596?d=identicon)[justintadlock](/maintainers/justintadlock)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/x3p0-dev-x3p0-prelude/health.svg)

```
[![Health](https://phpackages.com/badges/x3p0-dev-x3p0-prelude/health.svg)](https://phpackages.com/packages/x3p0-dev-x3p0-prelude)
```

###  Alternatives

[timkelty/craftcms-site-sync

Sync content to other sites on element save.

393.2k](/packages/timkelty-craftcms-site-sync)[mascame/arrayer

Array manipulation with dot notation. Also prepares an array to be put in a file. Very useful for config files.

141.4k2](/packages/mascame-arrayer)

PHPackages © 2026

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