• Stars
    star
    134
  • Rank 270,967 (Top 6 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 7 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

Imposter Plugin

Packagist Packagist PHP from Packagist CircleCI license Twitter Follow @TangRufus Hire Typist Tech

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

Built with β™₯ by Typist Tech


Imposter Plugin 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 Sponsor via PayPal More Sponsorship Information


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

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:

Install

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.


Typist Tech is ready to build your next awesome WordPress site. Hire us!


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.

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

Learn more on imposter's readme.

Known Issues

Help wanted. Pull requests are welcomed.

  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.

How about not hooking into composer commands?

Use imposter directly.

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.

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

To composer require impostified plugins, use wpackagist.org.

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.

In the meantime, checkout these tools to make WordPress suck less modernizing WordPress development:

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

Here you go:

Add your own here

Which composer versions are supported?

Both v1 and v2.

Will you add support for older PHP versions?

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.

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:

Testing

composer test
composer style:check

Alternatives

Here is a list of alternatives that I found. However, none of these 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
  • PHP Scoper

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

Security Vulnerabilities

If you discover a security vulnerability within this project, please email us at [email protected]. All security vulnerabilities will be promptly addressed.

Credits

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

Full list of contributors can be found here.

License

Imposter Plugin is released under the MIT License.

More Repositories

1

image-optimize-command

Easily optimize images using WP CLI
PHP
164
star
2

imposter

Wrapping all composer vendor packages inside your own namespace. Intended for WordPress plugins
PHP
98
star
3

trellis-cloudflare-origin-ca

Add Cloudflare Origin CA to Trellis as a SSL provider
Jinja
35
star
4

vagrant-trellis-sequel

Open Trellis databases in Sequel Pro with a single command
Ruby
35
star
5

sunny

Automatically purge Cloudflare cache, including cache everything rules.
PHP
34
star
6

wp-contained-hook

Lazily instantiate objects from dependency injection container to WordPress hooks (actions and filters)
PHP
25
star
7

vagrant-trellis-cert

Trust all Trellis self-signed certificates with a single command
Ruby
25
star
8

trellis-newrelic-php

Install New Relic PHP agent on Trellis servers
Jinja
24
star
9

wp-password-argon-two

Securely store WordPress user passwords in database with Argon2i hashing and SHA-512 HMAC using PHP's native functions.
PHP
21
star
10

wp-admin-notices

A simplified OOP implementation of the WordPress admin notices.
PHP
16
star
11

wp-admin-tabs

Create tabbed navigation for WordPress admin dashboard, the OOP way.
PHP
16
star
12

wp-cloudflare-guard

Connecting WordPress with Cloudflare firewall, protect your WordPress site at DNS level. Automatically create firewall rules to block dangerous IPs
PHP
15
star
13

tiller-circleci

Deploy Trellis, Bedrock and Sage via CircleCI
14
star
14

wp-better-settings

A simplified OOP implementation of the WP Settings API
PHP
14
star
15

wp-option-store

Extending WordPress Options API, read options from places other than database, the OOP way
PHP
14
star
16

travis-nginx-wordpress

A basic template for Nginx and WordPress running on Travis CI's container based infrastructure
Shell
7
star
17

pickaxe-coinhive-miner-chrome

Mine Monero (XMR) on Chrome using Coinhive JavaScript miner
HTML
6
star
18

wp-kses-view

Safely rendering for WordPress, the OOP way
PHP
5
star
19

codeception-composer-project-module

Create throw away composer projects for Codeception tests
PHP
3
star
20

wp-tabbed-admin-pages

Create WordPress admin pages with tabbed navigations, the OOP way
PHP
3
star
21

vagrant-sudo-rsync

[Abandoned] Copy files from/to a Vagrant VM via `sudo rsync`
Ruby
3
star
22

remove-medium-cross-links

Remove Medium cross links footer from WordPress posts
PHP
2
star
23

sunny-purge-extra-urls-example

PHP
2
star
24

cloudflare-wp-api

WordPress HTTP API replacement of the jamesryanbell/cloudflare package.
PHP
2
star
25

jailbreak-disable-json-api

[Deprecated] Allow whitelisted routes to pass through DRA filters
PHP
2
star
26

clepsydra-chrome

Chrome Extension: Open faucet pages automatically. Never loss your daily reward again!
HTML
1
star