PHPackages                             coenjacobs/mozart - 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. coenjacobs/mozart

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

coenjacobs/mozart
=================

Composes all dependencies as a package inside a WordPress plugin

1.2.1(2mo ago)4723.6M—3%66[69 issues](https://github.com/coenjacobs/mozart/issues)16MITPHPPHP ^8.2CI passing

Since Mar 6Pushed 1mo ago9 watchersCompare

[ Source](https://github.com/coenjacobs/mozart)[ Packagist](https://packagist.org/packages/coenjacobs/mozart)[ GitHub Sponsors](https://github.com/coenjacobs)[ RSS](/packages/coenjacobs-mozart/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (32)Versions (54)Used By (16)

Mozart [![Latest Stable Version](https://camo.githubusercontent.com/eceae899c9ea47fe334fe6130ca4943cdb5421bf2cb5c2ded6bf49e2441caab2/68747470733a2f2f706f7365722e707567782e6f72672f636f656e6a61636f62732f6d6f7a6172742f762f737461626c652e737667)](https://packagist.org/packages/coenjacobs/mozart) [![License](https://camo.githubusercontent.com/25809eb0a3c3f6393f4b8948de465b1d6c9d07755542b9f42e02573614d0be5a/68747470733a2f2f706f7365722e707567782e6f72672f636f656e6a61636f62732f6d6f7a6172742f6c6963656e73652e737667)](https://packagist.org/packages/coenjacobs/mozart) [![Total Downloads](https://camo.githubusercontent.com/4d42dc621c7378aed9c85517c32541bf5091ce860a70fb9a5a71bf206d769543/68747470733a2f2f706f7365722e707567782e6f72672f636f656e6a61636f62732f6d6f7a6172742f646f776e6c6f616473)](//packagist.org/packages/coenjacobs/mozart) [![Docker Image Pulls](https://camo.githubusercontent.com/3150ea72cdbfd4c1cfa289429489e921ce137eb5d5f666dbfcacf70df357aafe/68747470733a2f2f696d672e736869656c64732e696f2f646f636b65722f70756c6c732f636f656e6a61636f62732f6d6f7a6172742e737667)](https://hub.docker.com/r/coenjacobs/mozart)
=======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#mozart----)

Composes all dependencies as a package inside a WordPress plugin. Load packages through Composer and have them wrapped inside your own namespace. Gone are the days when plugins could load conflicting versions of the same package, resulting in hard to reproduce bugs.

This package requires PHP 8.2 or higher in order to run the tool. You can use the resulting files as a bundle, requiring any PHP version you like, even PHP 5.2.

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

[](#how-it-works)

Mozart takes your Composer dependencies, copies them into your plugin, and rewrites their namespaces and class names so they can't conflict with other plugins loading the same packages.

For namespaced packages, Mozart prefixes the namespace and updates all references:

```
-namespace Pimple;
+namespace CoenJacobs\TestProject\Dependencies\Pimple;

-use Psr\Container\ContainerInterface;
+use CoenJacobs\TestProject\Dependencies\Psr\Container\ContainerInterface;

 class Container implements ContainerInterface
```

For packages using global-scope classes, Mozart adds a prefix to class names:

```
-class Container {
+class CJTP_Container {
     // ...
 }

-$container = new Container();
+$container = new CJTP_Container();
```

This happens across the full dependency tree — namespace declarations, `use` statements, type hints, string references in `class_exists()` calls, and more. The result is a self-contained copy of your dependencies that won't collide with any other plugin's versions.

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

[](#installation)

Mozart brings its own dependencies to the table and that potentially introduces its own problems (yes, I realise how meta that is, for a package like this). That's why installing Mozart in isolation, either through the Docker container, the available PHAR file or installing Mozart as a global dependency with Composer is preferred.

```
docker run --rm -it -v ${PWD}:/project/ coenjacobs/mozart /mozart/bin/mozart compose

```

See [docs/installation.md](docs/installation.md) for all installation methods (Docker, PHAR, Composer).

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

[](#configuration)

Mozart potentially requires zero configuration. When your project has a PSR-4 autoload entry or a package name in `composer.json`, Mozart infers everything it needs: the dependency namespace, target directories, classmap prefix, and the generated dependency autoloader. In the default setup, run `mozart compose` and then include the generated `dep_directory/autoload.php` from your plugin bootstrap.

If you want to customize the behavior, add an `extra.mozart` block to your `composer.json`. Even an empty block is valid — Mozart fills in every setting it can infer:

```
"extra": {
    "mozart": {}
}
```

You can verify the resolved configuration with `mozart config`.

For full control, you can set every option explicitly:

```
"extra": {
    "mozart": {
        "dep_namespace": "CoenJacobs\\TestProject\\Dependencies\\",
        "dep_directory": "/src/Dependencies/",
        "classmap_directory": "/classes/dependencies/",
        "classmap_prefix": "CJTP_",
        "constant_prefix": "CJTP_",
        "functions_prefix": "cjtp_",
        "generate_autoloader": true,
        "packages": [
            "pimple/pimple"
        ],
        "excluded_packages": [
            "psr/container"
        ],
        "override_autoload": {
            "google/apiclient": {
                "classmap": [
                    "src/"
                ]
            }
        },
        "delete_vendor_directories": true
    }
},
```

The core settings and their defaults:

- `dep_namespace` — root namespace for bundled packages. *Default: inferred from your PSR-4 autoload namespace + `\Dependencies`, or from the package name.*
- `dep_directory` — target directory for namespaced package files. *Default: `vendor-prefixed/`.*
- `classmap_directory` — target directory for classmap package files. *Default: same as `dep_directory`.*
- `classmap_prefix` — prefix applied to classmap class names. *Default: derived from `dep_namespace` with `\` replaced by `_`.*
- `constant_prefix` — prefix for global-scope constants. *Default: derived from `classmap_prefix` by uppercasing it.*
- `functions_prefix` — prefix for global-scope functions. *Default: derived from `classmap_prefix` by lowercasing it.*
- `generate_autoloader` — generate a Composer-compatible autoloader for prefixed dependencies. *Default: `true`.*

See [docs/configuration.md](docs/configuration.md) for the full configuration reference with defaults and inference logic.

Supported versions
------------------

[](#supported-versions)

VersionDocumentationLatest release1.3[README.md](https://github.com/coenjacobs/mozart/blob/master/README.md)(in development)1.2[README.md](https://github.com/coenjacobs/mozart/blob/release-1.2/README.md)[1.2.2](https://github.com/coenjacobs/mozart/releases/tag/1.2.2)1.1[README.md](https://github.com/coenjacobs/mozart/blob/release-1.1/README.md)[1.1.6](https://github.com/coenjacobs/mozart/releases/tag/1.1.6)### No longer supported

[](#no-longer-supported)

VersionDocumentationLatest release1.0[README.md](https://github.com/coenjacobs/mozart/blob/release-1.0/README.md)[1.0.10](https://github.com/coenjacobs/mozart/releases/tag/1.0.10)0.7[README.md](https://github.com/coenjacobs/mozart/blob/release-0.7/README.md)[0.7.1](https://github.com/coenjacobs/mozart/releases/tag/0.7.1)0.6[README.md](https://github.com/coenjacobs/mozart/blob/release-0.6/README.md)[0.6.0](https://github.com/coenjacobs/mozart/releases/tag/0.6.0)Further reading
---------------

[](#further-reading)

DocumentDescription[docs/installation.md](docs/installation.md)All installation methods: Docker, PHAR, Composer[docs/configuration.md](docs/configuration.md)Full configuration reference with defaults and inference[docs/usage.md](docs/usage.md)Automating Mozart with Composer scripts and using the generated autoloader[docs/docker.md](docs/docker.md)Docker registries, tag strategy, multi-architecture support[docs/background.md](docs/background.md)Why Mozart was created and how it compares to PHP-Scoper

###  Health Score

73

—

ExcellentBetter than 100% of packages

Maintenance86

Actively maintained with recent releases

Popularity64

Solid adoption and visibility

Community36

Small or concentrated contributor base

Maturity89

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 90.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

Every ~89 days

Recently: every ~2 days

Total

38

Last Release

60d ago

Major Versions

0.7.1 → 1.0.0-beta-12026-01-09

PHP version history (6 changes)0.2.1PHP &gt;=5.5.0

0.4.0PHP ^7.1

0.5.0PHP ^7.2

0.7.0PHP ^7.3|^8.0

1.0.0-beta-1PHP ^8.1

1.2.0PHP ^8.2

### Community

Maintainers

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

---

Top Contributors

[![coenjacobs](https://avatars.githubusercontent.com/u/245703?v=4)](https://github.com/coenjacobs "coenjacobs (634 commits)")[![BrianHenryIE](https://avatars.githubusercontent.com/u/4720401?v=4)](https://github.com/BrianHenryIE "BrianHenryIE (43 commits)")[![markjaquith](https://avatars.githubusercontent.com/u/353790?v=4)](https://github.com/markjaquith "markjaquith (7 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (4 commits)")[![nickvergessen](https://avatars.githubusercontent.com/u/213943?v=4)](https://github.com/nickvergessen "nickvergessen (3 commits)")[![Konamiman](https://avatars.githubusercontent.com/u/937723?v=4)](https://github.com/Konamiman "Konamiman (2 commits)")[![stephenharris](https://avatars.githubusercontent.com/u/3255034?v=4)](https://github.com/stephenharris "stephenharris (2 commits)")[![schlessera](https://avatars.githubusercontent.com/u/83631?v=4)](https://github.com/schlessera "schlessera (1 commits)")[![spencerfinnell](https://avatars.githubusercontent.com/u/491124?v=4)](https://github.com/spencerfinnell "spencerfinnell (1 commits)")[![kmgalanakis](https://avatars.githubusercontent.com/u/1268089?v=4)](https://github.com/kmgalanakis "kmgalanakis (1 commits)")

---

Tags

autoloadercomposerdependency-managementwordpress

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/coenjacobs-mozart/health.svg)

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

###  Alternatives

[laravel/framework

The Laravel Framework.

34.6k509.9M17.0k](/packages/laravel-framework)[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)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[brianhenryie/strauss

Prefixes dependencies namespaces so they are unique to your plugin

183340.9k20](/packages/brianhenryie-strauss)

PHPackages © 2026

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