Download the PHP package cn-consult/coding-standard without Composer

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

CN-Consult CodingStandard

Our Company-Wide Coding Standard based on PHP_CodeSniffer.

Currently this is targeted for PHP-Code only, but it may also be used to sniff JS-Code or CSS, but we have no special Sniffs or Code for these languages.

Usage

To use this repository, add it as dev-dependency to your composer.json: composer require --dev cn-consult/coding-standard:dev-master.

Aftewards create a file phpcs.xml in your project root and add the following contents:

Afterwards you can check your code by executing: vendor/bin/phpcs .

Development

To add new rules to our standard you should open up a youtrack-ticket and explain what you want to accomplish. You should add some examples that shows what the check should allow and/or disallow. When you get positive feedback you may implement your check. Before you implement a custom Sniff, it is a good idea to check if there perhaps already exists a Sniff that accomplishes what you want. Unfortunatly there is no single documentation that shows all available Sniffs. A good starting point may be https://github.com/squizlabs/PHP_CodeSniffer/wiki/Customisable-Sniff-Properties or having a look at the implemented Sniffs by name or searching after the required token in the sourcecode (for example T_FUNCTION). If there is no other way you may implement your own sniff by following this guide: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Coding-Standard-Tutorial

After you added your sniff, you can run phpcs through the provided script in tests/run-manually.sh and check if it works and outputs the correct issues for test-files. If all is like expected please make sure that your new sniff is tested properly.

How to add new good tests

This is really easy. Just add additional files in the examples/good/ directory that you don't expect to generate any output, and run the unit-tests. Your new files will be picked up automatically.

How to add new bad tests

This is a bit more involved. First add an example file in the examples/bad/ directory that should trigger some issue. The use the tests/generate-expected-bad-output.php to verify that the file shows the issues you expect and create an accompanying expected-file. The generate-expected-bad-output.php will guide you through this process, just read its output.


All versions of coding-standard with dependencies

PHP Build Version
Package Version
Requires squizlabs/php_codesniffer Version 3.5.4
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 cn-consult/coding-standard contains the following files

Loading the files please wait ....