PHPackages                             typisttech/imposter - 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. typisttech/imposter

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

typisttech/imposter
===================

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

0.6.1(5y ago)111286.6k↓37%16[5 PRs](https://github.com/typisttech/imposter/pulls)1MITPHPPHP ^7.3 || ^8.0CI failing

Since Mar 21Pushed 3y ago3 watchersCompare

[ Source](https://github.com/typisttech/imposter)[ Packagist](https://packagist.org/packages/typisttech/imposter)[ Docs](https://github.com/TypistTech/imposter)[ Fund](https://typist.tech/donation/)[ Fund](https://www.paypal.me/iAmTangRufus/30usd)[ RSS](/packages/typisttech-imposter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (18)Used By (1)

Imposter
========

[](#imposter)

[![Packagist Version](https://camo.githubusercontent.com/81840ed56e5be09ccd6ab9fb90210aa4ec8160821e5d3fd4dcc3539879fbff72/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f747970697374746563682f696d706f737465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/typisttech/imposter)[![Packagist Downloads](https://camo.githubusercontent.com/f7d1f97f790bd66db6444e8d267d94b52604472211de551ddd71f6fa10d7ca6a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f747970697374746563682f696d706f737465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/typisttech/imposter)[![PHP from Packagist](https://camo.githubusercontent.com/ab22f7a9fc0cf62dff0fc61ab915b952d516e33c7a32d380d66c88a858dcdcbb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f547970697374546563682f696d706f737465723f7374796c653d666c61742d737175617265)](https://packagist.org/packages/typisttech/imposter)[![CircleCI](https://camo.githubusercontent.com/c837f5d3ac306d02773acfa142c7ea2b01a1039319725c11989cc7385a46e769/68747470733a2f2f696d672e736869656c64732e696f2f636972636c6563692f6275696c642f67682f547970697374546563682f696d706f737465723f7374796c653d666c61742d737175617265)](https://circleci.com/gh/TypistTech/imposter)[![Codecov](https://camo.githubusercontent.com/8a00d414f95587b795bb9078fd6f35f7e0a22e87813d17dc758de664c23a87d6/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f67682f747970697374746563682f696d706f737465723f7374796c653d666c61742d737175617265)](https://codecov.io/gh/TypistTech/imposter)[![License](https://camo.githubusercontent.com/bcde7dc0b2094f834a16fc8909a76b7b88630452a11fcc8e41d7d9c797df7d1a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f547970697374546563682f696d706f737465722e7376673f7374796c653d666c61742d737175617265)](https://github.com/TypistTech/imposter/blob/master/LICENSE)[![Twitter Follow @TangRufus](https://camo.githubusercontent.com/a4aa54a559719fc76a4677ca1d7ec33443d14423085acb58d268fe77f09c61ce/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f666f6c6c6f772f54616e6752756675733f7374796c653d666c61742d73717561726526636f6c6f723d316461316632266c6f676f3d74776974746572)](https://twitter.com/tangrufus)[![Hire Typist Tech](https://camo.githubusercontent.com/8dd68fe769812bdfb1c34fd397ff5e022170342b1d3a47c53055c566ffe8489d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f486972652d547970697374253230546563682d6666363962342e7376673f7374796c653d666c61742d737175617265)](https://www.typist.tech/contact/)

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

 Built with ♥ by [Typist Tech](https://www.typist.tech/)

---

**Imposter** is an open source project and completely free to use.

However, the amount of effort needed to maintain and develop new features is not sustainable without proper financial backing. If you have the capability, please consider donating using the links below:

[![GitHub via Sponsor](https://camo.githubusercontent.com/9c923c0024fc20fbd1ea153035ab2b5bb25cf1423c5aa07c35fd3e16b227a307/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53706f6e736f722d4769744875622d6561346161613f7374796c653d666c61742d737175617265266c6f676f3d676974687562)](https://github.com/sponsors/TangRufus)[![Sponsor via PayPal](https://camo.githubusercontent.com/117a21252fdae389ecc103138cd11218cd7587caf3901b042dfe9dbe3690294e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53706f6e736f722d50617950616c2d626c75652e7376673f7374796c653d666c61742d737175617265266c6f676f3d70617970616c)](https://typist.tech/go/paypal-donate/)[![More Sponsorship Information](https://camo.githubusercontent.com/15df9b6725c174bae83d974b5cd09cc984d66ee62b3570785648de09de168736/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53706f6e736f722d4d6f726525323044657461696c732d6666363962343f7374796c653d666c61742d737175617265)](https://typist.tech/donate/imposter/)

---

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

Why?
----

[](#why)

Because of the lack of dependency management in WordPress, if two plugins bundled conflicting versions of the same package, hard-to-reproduce bugs arise. Monkey patching composer vendor packages, wrapping them inside your own namespace is a less-than-ideal solution to avoid such conflicts.

See:

- [A Narrative of Using Composer in a WordPress Plugin](https://wptavern.com/a-narrative-of-using-composer-in-a-wordpress-plugin)
- [A Warning About Using Composer With WordPress](https://wppusher.com/blog/a-warning-about-using-composer-with-wordpress/)
- [Plugin Dependencies (Yet Another Plugin Dependencies Ticket)](https://core.trac.wordpress.org/ticket/22316)

Install
-------

[](#install)

> If you want to hook Imposter into [composer command events](https://getcomposer.org/doc/articles/scripts.md#command-events), install [Imposter Plugin](https://github.com/TypistTech/imposter-plugin) instead. See: [How can I integrate Imposter with composer?](#how-can-i-integrate-imposter-with-composer)

Installation should be done via composer, details of how to install composer can be found at .

```
composer require typisttech/imposter
```

Config
------

[](#config)

In your `composer.json`:

```
"extra": {
    "imposter": {
        "namespace": "My\\App\\Vendor",
        "excludes": [
            "dummy/dummy-excluded"
        ]
    }
}
```

### extra.imposter.namespace

[](#extraimposternamespace)

*Required* String

This is the namespace prefix to be added to vendor packages.

### extra.imposter.excludes

[](#extraimposterexcludes)

*Optional* Array of strings

Vendor packages which needs to be excluded from namespace prefixing. All [composer-made packages](https://packagist.org/packages/composer/) are excluded by default. Besides, anything under the `Composer` namespace will be excluded.

Usage
-----

[](#usage)

After every `$ composer install` and `$ composer update`:

```
