{"repo":"wpify/scoper","free":true,"listed":false,"github":"https://github.com/wpify/scoper","clone":"git clone https://github.com/wpify/scoper.git","description":"Composer plugin that scopes dependencies for WordPress plugins and themes, keeping WordPress and WooCommerce symbols unprefixed.","language":"PHP","stars":33,"topics":["composer-plugin","dependency-conflicts","namespace-isolation","php","php-scoper","prefixing","woocommerce","wordpress"],"license":null,"category":"ecommerce","readme_excerpt":"wpify/scoper A Composer plugin that moves your dependencies into a namespace of your own, so that your WordPress plugin or theme cannot collide with anybody else's. The problem WordPress loads every active plugin into one PHP process, and PHP has one global namespace. Your plugin requires guzzlehttp/guzzle 7. Another plugin on the same site bundles Guzzle 6. Whichever autoloader registers first wins, the other plugin gets a class it does not recognise, and something fatals — on a site you do not control and cannot test against. PHP Scoper solves this by rewriting your dependencies under a prefix that nobody else will use. But it prefixes everything it can see, WordPress's own functions and classes included, so a scoped plugin ends up calling MyPlugin\\Deps\\add action() — which does not exist. This plugin is PHP Scoper wired up correctly for WordPress. It ships a generated database of every symbol declared by WordPress, WooCommerce, Action Scheduler and WP-CLI, and keeps those unprefixed while everything else moves into your namespace. Requirements PHP 8.2 or newer , and Composer 2.6 or newer. Quickstart Install the plugin globally, pinned to a major version: In your plugin, declare the dependencies you want scoped in composer-deps.json — same format as composer.json , but it holds only the dependencies that get prefixed: Then tell the plugin what namespace to use, in your ordinary composer.json : Run Composer: The scoped tree is written to deps/ . Load its autoloader alongside","default_branch":null,"files":null,"tree":[],"storefront":"/r/wpify","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/wpify/scoper/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}