Download the PHP package joomla/cms-coding-standards without Composer

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

The Joomla project has migrated all its code to use PSR-12 codestyle instead of a custom version. If you are using this codestyle, you should also migrate to PSR-12. This codestyle will not get any further maintenance and is therefore archived since March 2024.

cms-coding-standards

Extended Joomla Coding Standards definition for use in the Joomla CMS environment

This repository includes the Joomla CMS coding standard definition for PHP Codesniffer. The PHP_CodeSniffer standard will never be 100% accurate, but should be viewed as a strong set of guidelines while writing software for Joomla.

See Joomla coding standards documentation at https://developer.joomla.org/coding-standards.html

If you want to contribute and improve this documentation, you can find the source files in the manual section of the master branch https://github.com/joomla/coding-standards/tree/master/manual

Requirements

Installation via Composer

Add "joomla/cms-coding-standards": "~1.0" to the require-dev block in your composer.json and then run composer install.

Alternatively, you can simply run the following from the command line:

Running

You can use the installed Joomla standard like:

phpcs --standard=Joomla-CMS path/to/code

Alternatively if it isn't installed you can still reference it by path like:

phpcs --standard=path/to/joomla/cms-coding-standards path/to/code

Selectively Applying Rules

NOTE: this should be an exact copy of the "Selectively Applying Rules" section of the main Joomla Coding Standards README and is here only for reference

For consuming packages there are some items that will typically result in creating their own project ruleset.xml, rather than just directly using the Joomla ruleset.xml. A project ruleset.xml allows the coding standard to be selectivly applied for excluding 3rd party libraries, for consideration of backwards compatability in existing projects, or for adjustments necessary for projects that do not need php 5.3 compatability (which will be removed in a future version of the Joomla Coding Standard in connection of the end of php 5.3 support in all active Joomla Projects).

For information on selectivly applying rules read details in the PHP CodeSniffer wiki

Common Rule Set Adjustments

The most common adjustment is to exclude folders with 3rd party libraries, or where the code has yet to have coding standards applied.

Another common adjustment is to exclude the camelCase format requirement for "Classes, Functions, Methods, Regular Variables and Class Properties" the essentially allows for B/C with snake_case variables which were only allowed in the context of interacting with the database.

Old Protected method names were at one time prefixed with an underscore. These Protected method names with underscores are depreceated in Joomla projects but for B\C reasons are still in the projects. As such excluding the MethodUnderscore sniff is a common ruleset adjustment

Using example rulesets that Selectively Applying Rule

You have to tell you can tell PHPCS where the example ruleset folder is (i.e. install them in PHPCS)

Note: the composer scripts will run when the standard is installed globally, but not when it's a dependancy. As such, you may want to run PHPCS config-set. When you run PHPCS config-set it will always overwrite the previous values. Use --config-show to check previous values before using --config-set So instead of overwriting the existing paths you should copy the existing paths revealed with --config-show and add each one seperated by a comma: phpcs --config-set installed_paths [path_1],[path_2],[/path/to/joomla-coding-standards],[/path/to/joomla/coding-standards/Example-Rulesets]


All versions of cms-coding-standards with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.10
joomla/coding-standards Version ~2.0 || ~3.0
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 joomla/cms-coding-standards contains the following files

Loading the files please wait ....