Git Product home page Git Product logo

wp-onus's Introduction

Project Onus

Centralised Composer dependency management for WordPress projects.

This allows you to have one vendor directory for your entire project. No more clashing libraries between different plugins that use Composer internally.

It works by going through every dependency of each plugin that has registered its use of Composer with Onus using WP_Onus::register(), finds a working configuration of library versions, and installs it centrally to avoid having multiple versions of the same package installed. Onus can also alert you of incompatible versions, ie. when one plugin requires Guzzle 1.0 and another plugin requires Guzzle 2.0.

This is a incomplete proof of concept. More info coming soon. Help welcome.

Setup

Clone this plugin:

git clone https://github.com/khromov/wp-onus

Install dependencies:

cd wp-onus/
composer install

Clone the two example plugins that demonstrate how dependency management works across plugins:

git clone https://github.com/khromov/wp-onus-test-plugin-1
git clone https://github.com/khromov/wp-onus-test-plugin-2

Example of how the integration works in external plugins:

https://github.com/khromov/wp-onus-test-plugin-1/blob/master/wp-onus-test-plugin-1.php#L14

The steps for plugins are:

  • Make sure to include at least a composer.json in the plugin root.
  • Don't load autoload.php if this plugin is active.
  • Register your root folder with this plugin so we can check for its composer.json.

Activate all three plugins.

Resolve dependencies and build

Add ?rebuild_deps=1 to your site URL to trigger a rebuild. The new resolved dependency autoloader will be in /wp-onus/resolved/vendor/autoload.php.

This will be configurable in a future version.

wp-onus's People

Contributors

khromov avatar

Stargazers

Leho Kraav avatar

Watchers

Leho Kraav avatar James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.