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 - A scoper for WordPress plugins and themes

Using Composer in your WordPress plugin or theme can benefit from that. But it also comes with a danger of conflicts with dependencies of other plugins or themes. Luckily, a great tool called PHP Scoper adds all your needed dependencies to your namespace to prevent conflicts. Unfortunately, the configuration is non-trivial, and for that reason, we created the Composer plugin to make scoping easy in WordPress projects.

The main issue with PHP Scoper is that it also scopes global functions, constants and classes. Usually, that is what you want, but that also means that WordPress functions, classes and constants will be scoped. This Composer plugin solves that. It has an up-to-date database of all WordPress and WooCommerce symbols that we want to keep unscoped.

Requirements

Usage

  1. This composer plugin is meant to be installed globally, but you can also require it as a dev dependency.
  2. The configuration requires creating composer-deps.json file, that has exactly same structure like composer.json file, but serves only for scoped dependencies. Dependencies that you don't want to scope comes to composer.json.
  3. Add extra.wpify-scoper.prefix to you composer.json, where you can specify the namespace, where your dependencies will be in. All other config options (folder, globals, composerjson, composerlock, autorun) are optional.
  4. The easiest way how to use the scoper on development environment is to install WPify Scoper as a dev dependency. After each composer install or composer update, all the dependencies specified in composer-deps.json will be scoped for you.
  5. Add a config.platform option in your composer.json and composer-deps.json. This settings will make sure that the dependencies will be installed with the correct PHP version.

Example of composer.json with its default values

  1. Option autorun defaults to true so that scoping is run automatically upon composer update or install command. That is not what you want in all cases, so you can set it false if you need. To start prefixing manually, you need to add for example the line "wpify-scoper": "wpify-scoper" to the "scripts" section of your composer.json. You then run the script with the command composer wpify-scoper install or composer wpify-scoper update.

  2. Scoped dependencies will be in deps folder of your project. You must include the scoped autoload alongside with the composer autoloader.

  3. After that, you can use your dependencies with the namespace.

Example PHP file:

Deployment

Deployment with Gitlab CI

To use WPify Scoper with Gitlab CI, you can add the following job to your .gitlab-ci.yml file:

Deployment with Github Actions

To use WPify Scoper with Github Actions, you can add the following action:

Advanced configuration

PHP Scoper has plenty of configuration options. You can modify this configuration array by creating scoper.custom.php file in root of your project. The file should contain customize_php_scoper_config function, where the first parameter is the preconfigured configuration array. Expected output is valid PHP Scoper configuration array.

Example scoper.custom.php file


All versions of scoper with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
composer-plugin-api Version ^2.3
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 ....