/php-scoper

PHP-Scoper prefixes all PHP namespaces in a file/directory.

Primary LanguagePHPMIT LicenseMIT

PHP-Scoper

Build Status Build status Scrutinizer Code Quality Latest Stable Version Total Downloads Dependency Status

Latest release: none

PHP >= 5.5

PHP-Scoper is a tool for adding a prefix to all PHP namespaces in a given file or directory.

Goal

PHP-Scoper's goal is to make sure that all code in a directory lies in a distinct PHP namespace. This is necessary when building PHARs that

  • bundle their own vendor dependencies
  • load code of arbitrary PHP projects

These PHARs run the risk of raising conflicts between their bundled vendors and the vendors of the loaded project, if the vendors are required in incompatible versions.

Usage

Use PHP-Scoper like this:

$ php-scoper add-prefix MyPhar\\ .

The first argument is the prefix to add to all namespace declarations and class usages. The second argument is one or more files/directories which should be processed.

Authors

Contribute

Contributions to are very welcome!

Support

If you are having problems, send a mail to bschussek@gmail.com or shout out to @webmozart on Twitter.

License

All contents of this package are licensed under the MIT license.