Download the PHP package wpify/scoper without Composer

On this page you can find all versions of the php package wpify/scoper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package scoper

wpify/scoper

CI Packagist Downloads PHP

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 Composer's own:

That class is yours alone. The other plugin's Guzzle no longer matters.

Full walkthrough with the verification steps: Getting started.

Publishing to WordPress.org?

Write the scoped tree to vendor-prefixed/ instead. Since October 2024 every new plugin submitted to the WordPress.org directory is run through Plugin Check first, and an error blocks the submission until it is fixed. Plugin Check skips vendor-prefixed/ — it carries the name in its ignore list precisely so that prefixed dependencies do not raise false positives — but it does scan deps/, so a scoped Guzzle gets read as your code and reported for every file_get_contents() and curl_* call in it, none of which you can fix.

Add /vendor-prefixed/ to .gitignore, and make sure your release build does not strip it. The full picture — what the exemption does and does not cover, and the checklist to run before submitting — is in Publishing to WordPress.org.

Documentation

Getting started Install it and scope your first dependency, start to finish.
Configuration Every extra.wpify-scoper key, every command, every environment variable.
Troubleshooting Symptom, cause, fix. Start here when something is wrong.
Publishing to WordPress.org Why the scoped tree belongs in vendor-prefixed/, and the pre-submission checklist.
Deployment What to commit, CI recipes, Bedrock, multi-plugin repositories.
Customizing php-scoper scoper.custom.php and patchers, for dependencies that need help.
How it works The symbol lists, the pipeline, and why the scoped tree is swapped rather than written in place.
Upgrading to 4.0 Coming from 3.2 or earlier.

Contributing

Bug reports, symbol-list regressions and pull requests are welcome. See CONTRIBUTING.md — in particular for what sources/ is, why require-dev contains WordPress, and how to regenerate the symbol lists.

Security issues should not go in a public issue. See SECURITY.md.

License

WPify s.r.o. and contributors.


All versions of scoper with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
composer-plugin-api Version ^2.3
composer-runtime-api Version ^2.2
composer/composer Version ^2.6
wpify/php-scoper Version ^0.18
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wpify/scoper contains the following files

Loading the files please wait ...