Wrapping all composer vendor packages inside your own namespace. Intended for WordPress plugins. Imposter Plugin is a composer plugin wrapper for Imposter.
- Why?
- Install
- Usage
- Known Issues
- Frequently Asked Questions
- Sponsoring ❤️
- Running the Tests
- Alternatives
- Feedback
- Change log
- Security
- Credits
- License
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:
Installation should be done via composer, details of how to install composer can be found at https://getcomposer.org/.
First, add Imposter configuration in your composer.json
"extra": {
"imposter": {
"namespace": "My\\App\\Vendor",
"excludes": [
"dummy/dummy-excluded"
]
}
}
Then, install via composer cli
$ composer require typisttech/imposter-plugin
See: Imposter readme for details.
Once installed, this plugin hooks into composer install
, composer update
and composer dump-autoload
, automatically run imposter for you.
Besides, imposter plugin autoloads all modified files as classmap.
When those events triggered, this plugin:
- looks for
/path/to/project/root/composer.json
- finds out vendor-dir
- finds out all required packages, including those required by dependencies
- finds out all autoload paths for all required packages
- prefixes all namespaces with the imposter-plugin namespace defined in your
composer.json
Learn more on imposter's readme.
Help wanted. Pull requests are welcomed.
- Imposter run twice when
composer install
andcomposer update
- Traits are not transformed
- Virtual packages are not supported
Learn more on imposter's readme for more details.
Use imposter directly.
Here you go:
Add your own here
Never! This plugin will only work on actively supported PHP versions.
Don't use it on end of life or security fixes only PHP versions.
- Articles on Typist Tech's blog
- More projects on Typist Tech's GitHub profile
- More plugins on TangRufus' wp.org profiles
- Stay tuned on Typist Tech's newsletter
- Follow @TangRufus on Twitter
- Hire Tang Rufus to build your next awesome site
Thanks! Glad you like it. It's important to let my know somebody is using this project. Since this is not hosted on wordpress.org, please consider:
- tweet something good with mentioning @TangRufus
- ⭐ star this Github repo
- 👀 watch this Github repo
- write blog posts
- submit pull requests
- sponsor Tang Rufus to maintain his open source projects
- hire Tang Rufus to build your next awesome site
Love Imposter Plugin
? Help me maintain it, a sponsorship here can help with it.
Do you know GitHub is going to match your sponsorship?
Sponsor now via GitHub to double your greatness.
Ready to take freelance WordPress jobs. Contact me via the contact form here or, via email info@typist.tech
Contact: Tang Rufus
Run the tests:
$ composer test
$ composer style:check
Here is a list of alternatives that I found. But none satisfied my requirements.
If you know other similar projects, feel free to edit this section!
-
Mozart by Coen Jacobs
- Works with PSR0 and PSR4
- Dependency packages store in a different directory
-
- Prefixes all PHP namespaces in a file/directory to isolate the code bundled in PHARs
Please provide feedback! We want to make this library useful in as many projects as possible. Please submit an issue and point out what you do and don't like, or fork the project and make suggestions. No issue is too small.
Please see CHANGELOG for more information on what has changed recently.
If you discover any security related issues, please email imposter-plugin@typist.tech instead of using the issue tracker.
imposter-plugin
is a Typist Tech project and maintained by Tang Rufus, freelance developer for hire.
Full list of contributors can be found here.
The MIT License (MIT). Please see License File for more information.