Search by

wpelevator / vendor-isolator

kasparsd

Composer plugin to isolate project dependencies by prefixing their namespace

Package info

github.com/wpelevator/vendor-isolator

Type:composer-plugin

pkg:composer/wpelevator/vendor-isolator

Statistics

Installs: 2 204

Dependents: 0

Suggesters: 0

Stars: 1

0.1.1 2026-09-11 09:34 UTC

This package is auto-updated.

Last update: 2026-09-11 15:49:30 UTC


README

Composer plugin to isolate project dependencies by prefixing their namespace.

Requirements

How it Works

  • It registers itself as a Composer plugin when you add it to your project through the extra.class directive in the composer.json file pointing to WPElevator\Vendor_Isolator\Plugin in php/class-plugin.php.

  • It hooks into pre-autoload-dump and post-autoload-dump Composer events and uses nikic/php-parser to rewrite the namespaces and classname references for all non-development dependencies. It ignores all global function and classes.

To Do

  • Describe how this is different from php-scoper and other projects.

Features and Limitations

  • It only rewrites the non-development dependencies in the vendor directory, therefore your application code must reference the isolated dependencies by their prefixed namespace.

  • 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.

  • It prefixes the single part imports of dependency namespaces such as use Nette; so that relative names like Nette\SmartObject resolve to the prefixed namespace, while imports of global classes such as use Throwable; are left as is.

Credits

A fork of and/composer-isolation.