Download the PHP package phpcsstandards/phpcsutils without Composer
On this page you can find all versions of the php package phpcsstandards/phpcsutils. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phpcsstandards/phpcsutils
More information about phpcsstandards/phpcsutils
Files in phpcsstandards/phpcsutils
Package phpcsutils
Short Description A suite of utility functions for use with PHP_CodeSniffer
License LGPL-3.0-or-later
Homepage https://phpcsutils.com/
Informations about the package phpcsutils
PHPCSUtils: A suite of utility functions for use with PHP_CodeSniffer
- Features
- Minimum Requirements
- Integrating PHPCSUtils in your external PHPCS standard
- Composer-based
- Non-Composer based integration
- Frequently Asked Questions
- Potential Support Questions from your End-Users
- Contributing
- License
Features
PHPCSUtils is a set of utilities to aid developers of sniffs for PHP_CodeSniffer (or "PHPCS" for short).
This package offers the following features:
Minimum Requirements
- PHP 5.4 or higher.
- PHP_CodeSniffer 3.10.1+.
- Recommended PHP extensions for optimal functionality:
- PCRE with Unicode support (normally enabled by default)
Integrating PHPCSUtils in your external PHPCS standard
Composer-based
If your external PHP_CodeSniffer standard only supports Composer-based installs, integrating PHPCSUtils is pretty straight forward.
Run the following from the root of your external PHPCS standard's project:
No further action needed. You can start using all the utility functions, abstract sniff classes and other features of PHPCSUtils straight away.
:information_source: The PHPCSUtils package includes the Composer PHPCS plugin.
This plugin will automatically register PHPCSUtils (and your own external standard) with PHP_CodeSniffer, so you and your users don't have to worry about this anymore.
:warning: Note: if your end-user installation instructions include instructions on adding a Composer PHPCS plugin or on manually registering your standard with PHPCS using the
--config-set installed_paths
command, you can remove those instructions as they are no longer needed.:information_source: As of Composer 2.2, Composer will ask for permission to allow the Composer PHPCS plugin to execute code. For the plugin to be functional, permission needs to be granted. This can be done ahead of time by instructing your users to run the following command before installing your standard:
Running your unit tests
If your unit tests use the PHP_CodeSniffer native unit test suite, all is good.
If you have your own unit test suite to test your sniffs, make sure to load the Composer vendor/autoload.php
file in your PHPUnit bootstrap file or as the PHPUnit bootstrap file.
If you intend to use the test utilities provided in the PHPCSUtils/TestUtils
directory, make sure you also load the vendor/phpcsstandards/phpcsutils/phpcsutils-autoload.php
file in your PHPUnit bootstrap file.
Non-Composer based integration
In this case, more than anything, you will need to update the non-Composer installation instructions for your end-users.
To use a non-Composer based installation for your sniff development environment, the same instructions would apply.
Your installation instructions for a non-Composer based installation will probably look similar to this:
- Install PHP_CodeSniffer via your preferred method.
- Register the path to PHPCS in your system
$PATH
environment variable to make thephpcs
command available from anywhere in your file system.- Download the [latest YourStandardName release] and unzip/untar it into an arbitrary directory. You can also choose to clone the repository using git.
Add the path to the directory in which you placed your copy of the YourStandardName repo to the PHP_CodeSniffer configuration using the below command:
Warning: :warning: The
installed_paths
command overwrites any previously setinstalled_paths
. If you have previously setinstalled_paths
for other external standards, runphpcs --config-show
first and then run theinstalled_paths
command with all the paths you need separated by comma's, i.e.:
For things to continue working when you add PHPCSUtils to your standard, you need to replace the last bullet with this:
- Next, download the latest PHPCSUtils release and unzip/untar it into an arbitrary directory. You can also choose to clone the repository using git.
Add the path to the directories in which you placed your copy of the YourStandardName repo and the PHPCSUtils repo to the PHP_CodeSniffer configuration using the below command:
Warning: :warning: The
installed_paths
command overwrites any previously setinstalled_paths
. If you have previously setinstalled_paths
for other external standards, runphpcs --config-show
first and then run theinstalled_paths
command with all the paths you need separated by comma's, i.e.:
Running your unit tests
To support non-Composer based installs for running your sniff unit tests, you will need to adjust the PHPUnit bootstrap.php
file to allow for passing an environment variable pointing to your PHPCSUtils installation.
Example bootstrap code using a PHPCSUtils_DIR
environment variable
Once that's done, you will need to make a small tweak to your own dev environment to get the unit tests running for a non-Composer based install:
- Copy your project's
phpunit.xml.dist
file tophpunit.xml
. - Add the following to the
phpunit.xml
file within the<phpunit>
tags, replacing/path/to/PHPCSUtils
with the path in which you installed PHPCSUtils on your local system:
Frequently Asked Questions
Potential Support Questions from your End-Users
Contributing
Contributions to this project are welcome. Clone the repo, branch off from develop
, make your changes, commit them and send in a pull request.
If you are unsure whether the changes you are proposing would be welcome, please open an issue first to discuss your proposal.
License
This code is released under the GNU Lesser General Public License (LGPLv3).
All versions of phpcsutils with dependencies
squizlabs/php_codesniffer Version ^3.10.0 || 4.0.x-dev@dev
dealerdirect/phpcodesniffer-composer-installer Version ^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0