PHPackages                             ilab/namespacer - 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. ilab/namespacer

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

ilab/namespacer
===============

Tool for re-namespacing composer packages for use in WordPress plugins.

0.2.0(5y ago)291.1k↓100%7[1 PRs](https://github.com/Interfacelab/namespacer/pulls)LGPL-3.0-or-laterPHP

Since Aug 25Pushed 2y ago2 watchersCompare

[ Source](https://github.com/Interfacelab/namespacer)[ Packagist](https://packagist.org/packages/ilab/namespacer)[ RSS](/packages/ilab-namespacer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

Namespacer
==========

[](#namespacer)

Using composer when building WordPress plugins sound like a good idea at first, but it won't be long until you run into trouble when other plugins are loading incompatible versions of libraries that you are using. Our plugin, [MediaCloud](https://mediacloud.press), uses packages extensively - over 65 different libraries - many of them fairly common. I'd say over half of our support requests are due to conflicts with other plugins users have installed that are using outdated or newer versions of the same libraries we are using. The only way to really do that is to re-namespace the packages we are using and to be able to do that easily and safely.

Namespacer allows you to re-namespace any composer packages you are using by adding a namespace prefix to all of the namespaces as well as prefixing the package names too. It will then generate a folder called "lib" which you can safely include in your plugin.

Yes, I'm aware of projects out there like PHP-Scoper and Imposter and others. I've had issues with all of them, which is why I built this. Yoast and other plugins happily used PHP-Scoper, but their plugins, believe it or not, are much smaller than [MediaCloud](https://mediacloud.press). Yoast, for example, uses 4 composer packages.

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

[](#installation)

You can install this globally, but I think you'd be better off using it as the basis of a project via composer.

```
composer require ilab/namespacer
```

Usage
-----

[](#usage)

Once installed:

```
./vendor/bin/renamespace [--composer COMPOSER] [--source SOURCE] [--package PACKAGE] [--namespace NAMESPACE] [--config CONFIG]
```

### Arguments

[](#arguments)

ArgumentDescription`composer`The path (full or relative) to the composer file containing all the package dependencies you want to renamespace. You must specify this argument OR the `source` argument.`source`The path (full or relative) to a directory containing a composer file and an existing vendor directory. When using `source` the vendor directory must already exist (`composer update` must already have been run). You must specify this argument OR the `composer` argument.`package`The prefix to append to package names, for example specifying `--package mcloud` will turn `nesbot/carbon` into `mcloud-nesbot/carbon`. Default is `mcloud`.`namespace`The prefix to append to namespaces, for example specifying `--namespace MediaCloud\Vendor` will transform `namespace Aws;` into `namespace MediaCloud\Vendor\Aws;`. Default is `MediaClound\Vendor`.`config`An optional PHP configuration file for inserting filters into the namespacing process.``The destination directory. Namespacer will create a directory named `lib` inside that directory, removing it first if it already exists.For example, you might run it:

```
./vendor/bin/namespacer --composer sample.composer.json --config patches.config.php --package mypackage --namespace MyNamespace\Vendor build/
```

In this example, we're pointing to a `composer.json` file containing the packages we want to re-namespace and to a config file that contains filters that will apply more manual patches during the re-namespace process. The output of the processing will be put into the `build/` folder.

### Filtering (Patching in PHP-Scoper parlance)

[](#filtering-patching-in-php-scoper-parlance)

You can see some example configurations in `vendor/ilab/namespacer/sample.config.php` and `vendor/ilab/namespacer/patches.config.php` that will demonstrate how to insert your own code into the namespacing process to catch special cases.

Reporting Bugs
--------------

[](#reporting-bugs)

If you run into issues, please open a ticket and attach the composer.json you were trying to process with a clear description of the problem.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity46

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 ~0 days

Total

3

Last Release

2082d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

wordpressnamespace

### Embed Badge

![Health badge](/badges/ilab-namespacer/health.svg)

```
[![Health](https://phpackages.com/badges/ilab-namespacer/health.svg)](https://phpackages.com/packages/ilab-namespacer)
```

###  Alternatives

[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.1M564](/packages/symfony-maker-bundle)[symplify/monorepo-builder

Not only Composer tools to build a Monorepo.

5205.3M81](/packages/symplify-monorepo-builder)[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)[typisttech/imposter

Wrapping all composer vendor packages inside your own namespace. Intended for WordPress plugins.

111286.6k1](/packages/typisttech-imposter)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

96374.6k23](/packages/friendsoftypo3-content-blocks)[shyim/danger-php

Port of danger to PHP

8544.9k](/packages/shyim-danger-php)

PHPackages © 2026

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