2017 © Pedro Peláez
 

composer-plugin imposter-plugin

Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins

image

typisttech/imposter-plugin

Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins

  • Tuesday, January 16, 2018
  • by TangRufus
  • Repository
  • 2 Watchers
  • 8 Stars
  • 23,194 Installations
  • PHP
  • 2 Dependents
  • 8 Suggesters
  • 1 Forks
  • 0 Open issues
  • 17 Versions
  • 10 % Grown

The README.md

# Imposter Plugin
[![Packagist](https://img.shields.io/packagist/v/typisttech/imposter-plugin.svg?style=flat-square)](https://packagist.org/packages/typisttech/imposter-plugin) [![Packagist](https://img.shields.io/packagist/dt/typisttech/imposter-plugin.svg?style=flat-square)](https://packagist.org/packages/typisttech/imposter-plugin) [![PHP from Packagist](https://img.shields.io/packagist/php-v/TypistTech/imposter-plugin?style=flat-square)](https://packagist.org/packages/typisttech/imposter-plugin) [![CircleCI](https://img.shields.io/circleci/build/gh/TypistTech/imposter-plugin?style=flat-square)](https://circleci.com/gh/TypistTech/imposter-plugin) [![license](https://img.shields.io/github/license/TypistTech/imposter-plugin.svg?style=flat-square)](https://github.com/TypistTech/imposter-plugin/blob/master/LICENSE) [![Twitter Follow @TangRufus](https://img.shields.io/twitter/follow/TangRufus?style=flat-square&color=1da1f2&logo=twitter)](https://twitter.com/tangrufus) [![Hire Typist Tech](https://img.shields.io/badge/Hire-Typist%20Tech-ff69b4.svg?style=flat-square)](https://www.typist.tech/contact/)

Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins.

Built with ♥ by Typist Tech , (*1)


Imposter Plugin is an open source project and completely free to use., (*2)

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:, (*3)

[![GitHub via Sponsor](https://img.shields.io/badge/Sponsor-GitHub-ea4aaa?style=flat-square&logo=github)](https://github.com/sponsors/TangRufus) [![Sponsor via PayPal](https://img.shields.io/badge/Sponsor-PayPal-blue.svg?style=flat-square&logo=paypal)](https://typist.tech/go/paypal-donate/) [![More Sponsorship Information](https://img.shields.io/badge/Sponsor-More%20Details-ff69b4?style=flat-square)](https://typist.tech/donate/imposter-plugin/)

Wrapping all composer vendor packages inside your own namespace. Intended for WordPress plugins. Imposter Plugin is a composer plugin wrapper for Imposter., (*4)

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., (*5)

See: - A Narrative of Using Composer in a WordPress Plugin - A Warning About Using Composer With WordPress - Plugin Dependencies (Yet Another Plugin Dependencies Ticket), (*6)

Install

Installation should be done via composer, details of how to install composer can be found at https://getcomposer.org/., (*7)

First, add Imposter configuration in your composer.json, (*8)

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

Then, install via composer cli, (*9)

composer require typisttech/imposter-plugin

See: Imposter readme for details., (*10)


Typist Tech is ready to build your next awesome WordPress site. Hire us! , (*11)


Usage

Sit Back and Relax

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., (*12)

When those events triggered, this plugin: 1. looks for /path/to/project/root/composer.json 2. finds out vendor-dir 3. finds out all required packages, including those required by dependencies 4. finds out all autoload paths for all required packages 5. prefixes all namespaces with the imposter-plugin namespace defined in your composer.json, (*13)

Learn more on imposter's readme., (*14)

Known Issues

Help wanted. Pull requests are welcomed., (*15)

  1. Imposter run twice when composer install and composer update
  2. Traits are not transformed
  3. Virtual packages are not supported

Frequently Asked Questions

What can I find more information?

Learn more on imposter's readme for more details., (*16)

How about not hooking into composer commands?

Use imposter directly., (*17)

How to distrube impostified plugins?

  1. Switch to the lowest PHP version you support
  2. Install dependencies
    • $ composer install --no-dev --classmap-authoritative --prefer-dist
  3. Clean up the source code, e.g: remove test files
  4. Zip the source code. Tips: Use $ composer archive
  5. Send the zip to others / Commit to wp.org SVN. Tips:

How to install impostified plugins via composer?

Impostified plugins are meant to be commited to wp.org svn., (*18)

Using imposter means you forgo the ability to install the plugins with composer directly via packagist.org or VCS (even with type: wordpress-plugin in composer.json)., (*19)

To composer require impostified plugins, use wpackagist.org., (*20)

The whole imposter situation is horrible. What can we do about it?

Until WordPress core comes up with a solution on dependency managment, keep clam and carry on., (*21)

In the meantime, checkout these tools ~~to make WordPress suck less~~ modernizing WordPress development:, (*22)

Do you have real life examples that use this composer plugin?

Here you go:, (*23)

Add your own here, (*24)

Which composer versions are supported?

Both v1 and v2., (*25)

Will you add support for older PHP versions?

Never! This plugin will only work on actively supported PHP versions., (*26)

Don't use it on end of life or security fixes only PHP versions., (*27)

It looks awesome. Where can I find some more goodies like this

Where can I give 5-star reviews?

Thanks! Glad you like it. It's important to let me knows somebody is using this project. Please consider:, (*28)

Testing

composer test
composer style:check

Alternatives

Here is a list of alternatives that I found. However, none of these satisfied my requirements., (*29)

If you know other similar projects, feel free to edit this section!, (*30)

  • Mozart by Coen Jacobs, (*31)

    • Works with PSR0 and PSR4
    • Dependency packages store in a different directory
  • PHP Scoper, (*32)

    • Prefixes all PHP namespaces in a file/directory to isolate the code bundled in PHARs

Feedback

Please provide feedback! We want to make this project as useful as possible. Please submit an issue and point out what you do and don't like, or fork the project and send pull requests. No issue is too small., (*33)

Security Vulnerabilities

If you discover a security vulnerability within this project, please email us at imposter-plugin@typist.tech. All security vulnerabilities will be promptly addressed., (*34)

Credits

Imposter Plugin is a Typist Tech project and maintained by Tang Rufus, freelance developer for hire., (*35)

Full list of contributors can be found here., (*36)

License

Imposter Plugin is released under the MIT License., (*37)

The Versions

16/01 2018

dev-master

9999999-dev https://www.typist.tech/projects/imposter-plugin

Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress composer dependency namespace composer-plugin monkey-patching

16/01 2018

0.3.0

0.3.0.0 https://www.typist.tech/projects/imposter-plugin

Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress composer dependency namespace composer-plugin monkey-patching

01/11 2017

dev-TangRufus-patch-1

dev-TangRufus-patch-1 https://www.typist.tech/projects/imposter-plugin

Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress composer dependency namespace composer-plugin monkey-patching

27/10 2017

dev-misc

dev-misc https://www.typist.tech/projects/imposter-plugin

Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress composer dependency namespace composer-plugin monkey-patching

22/10 2017

0.2.6

0.2.6.0 https://www.typist.tech/projects/imposter-plugin

Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress composer dependency namespace composer-plugin monkey-patching

15/09 2017

dev-composer-update

dev-composer-update https://www.typist.tech/projects/imposter-plugin

Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress composer dependency namespace composer-plugin monkey-patching

21/08 2017

dev-rename-conduct-md

dev-rename-conduct-md https://www.typist.tech/projects/imposter-plugin

Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress composer dependency namespace composer-plugin monkey-patching

26/03 2017

0.2.5

0.2.5.0 https://www.typist.tech/projects/imposter-plugin

Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress composer dependency namespace composer-plugin monkey-patching

26/03 2017

dev-version-bump

dev-version-bump https://www.typist.tech/projects/imposter-plugin

Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress composer dependency namespace composer-plugin monkey-patching

26/03 2017

dev-type-check-correctly

dev-type-check-correctly https://www.typist.tech/projects/imposter-plugin

Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress composer dependency namespace composer-plugin monkey-patching

26/03 2017

dev-fix-dump-autoload-twice

dev-fix-dump-autoload-twice https://www.typist.tech/projects/imposter-plugin

Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress composer dependency namespace composer-plugin monkey-patching

25/03 2017

0.2.4

0.2.4.0 https://www.typist.tech/projects/imposter-plugin

Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress composer dependency namespace composer-plugin monkey-patching

25/03 2017

0.2.3

0.2.3.0 https://www.typist.tech/projects/imposter-plugin

Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress composer dependency namespace composer-plugin monkey-patching

24/03 2017

0.2.2

0.2.2.0 https://www.typist.tech/projects/imposter-plugin

Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress composer dependency namespace composer-plugin monkey-patching

22/03 2017

0.2.1

0.2.1.0 https://www.typist.tech/projects/imposter-plugin

Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress composer dependency namespace composer-plugin monkey-patching

22/03 2017

0.2.0

0.2.0.0 https://www.typist.tech/projects/imposter-plugin

Composer plugin that wraps all composer vendor packages inside your own namespace. Intended for WordPress plugins

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress composer dependency namespace composer-plugin monkey-patching

21/03 2017

0.1.0

0.1.0.0 https://www.typist.tech/projects/imposter-plugin

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

  Sources   Download

MIT

The Requires

 

The Development Requires

wordpress composer dependency namespace composer-plugin monkey-patching