Download the PHP package dvsa/coding-standards without Composer

On this page you can find all versions of the php package dvsa/coding-standards. 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 coding-standards

DVSA PHP Coding Standards

A custom ruleset for PHP CodeSniffer and PHP-CS-Fixer for use in the Driver and Vehicles Standard Agency (DVSA). PHP Coding standards are maintained and updated by the developer community at the DVSA. See CONTRIBUTING.md for more information how make changes.

Prerequisites

Installation

composer require --dev dvsa/coding-standards

or if you install the coding standard tools globally use:

composer require global dvsa/coding-standards

How to set up

Refer to the How to run section for help with running/integrating in with code editors/IDE.

PHP CodeSniffer

Repository: https://github.com/squizlabs/PHP_CodeSniffer.

  1. Create a phpcs.dist.xml file in the root directory of your project. Example:

XML reference.

PHP-CS-Fixer

Repository: https://github.com/FriendsOfPHP/PHP-CS-Fixer.

Due to the number of dependencies in php-cs-fixer it must be installed manually.

  1. Recommended way to install using composer-bin-plugin.

  2. Install php-cs-fixer. It is recommended to install PHP-CS-Fixer in a separate working directory:

  3. Create a .php-cs-fixer.dist.php file in the root directory of your project.
  4. Add .php-cs-fixer.cache to your .gitignore. The cache filename can be changed using the $cacheFilename parameter (default: .php-cs-fixer.cache).
  5. Configure and return a PhpCsFixer\ConfigInterface object. This repository provides a preconfigured class:

Tip: Add .php-cs-fixer.php to your .gitignore to enable additional rules locally.

How to run

GitHooks

Recommended using a tool to handle the GitHooks functionality due to the manual steps to set up hooks (symlinks/copying). Lots of tools can be used to handle GitHooks.

Husky & lint-staged (NPM)

Repositories: Husky & lint-staged package.

  1. Install using NPM:

  2. Configure Husky:

  3. Create .lintstagedrc:

  4. Add lint-staged to the pre-commit hook:

The above pre-commit hook will utilise both PHP-CS-Fixer and PHPCS. The fixer will be run before PHP CodeSniffer.

Integrations

JetBrains (IntelliJ/PHPStorm)

JetBrains have comprehensive documentation for setting up code quality tools.

PHP CodeSniffer path to ruleset: /phpcs.dist.xml PHP CS Fixer path to ruleset: /.php-cs-fixer.dist.php

Licence

See LICENSE.md

Contributing

See CONTRIBUTING.md

Acknowledgements

This coding standard is a tweak on top of the PSR2 standard and only possible because of that. However particularly the time and effort of Chris Emerson BJSS is acknowledged for tidying this and working on it during his time on the VOL project.


All versions of coding-standards with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
squizlabs/php_codesniffer Version ^3.1
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 dvsa/coding-standards contains the following files

Loading the files please wait ....