Download the PHP package magento-ecg/coding-standard without Composer

On this page you can find all versions of the php package magento-ecg/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

ECG Magento Code Sniffer Coding Standard

SensioLabsInsight Medal

ECG Magento Code Sniffer Coding Standard is a set of rules and sniffs for PHP_CodeSniffer tool.

It allows automatically check your code against some of the common Magento and PHP coding issues, like:

and many others.

Both Magento and Magento 2 are supported.

Installation

Before starting using our coding standard install PHP_CodeSniffer.

The recommended installation method for PHPCS is globally with Composer:

Make sure Composer's bin directory (defaulted to ~/.composer/vendor/bin/) is in your PATH.

Clone or download this repo somewhere on your computer or install it with Composer:


Note: PHP_CodeSniffer 3.x is now required to run our coding standard. To install PHP_CodeSniffer 2.x compatible version:

Add the ECG standards directory to PHP_CodeSniffer's installed paths:

You can check Installation by running following command:

It should do the following output:

Usage CLI Tool

Select a standard to run with CodeSniffer: EcgM2 for Magento 2

Run CodeSniffer:

This package is compatible with Composer Installer Plugins for PHPCS coding standards (such as https://github.com/Dealerdirect/phpcodesniffer-composer-installer) and can be automatically registered with PHPCS during installation.

To check design templates, you must specify phtml in the --extensions argument: --extensions=php,phtml

Usage Hook pre-commit

Get hook file from the existing repository.

Install Hooks on the project. Copy hook into the project GIT folder

To automate hooks installation for all developers, it needs to include the following lines into your project's composer.json

Run composer install to refresh the project state.

You are done! Now, each product commit will be validated for an alignment with Magento Coding Standards.

Usage PHPStorm

PhpStorm provides code style check through integration with the PHP Code Sniffer tool, which validates your code for consistency with a coding standard and best practices.

Once Tool installed and configured in PhpStorm, the tool is available in any opened PHP file. Errors and warnings reported by PHP Code Sniffer on-the-fly are displayed as popup messages.

Install coding standard for development See Installation steps.

Configure PhpStorm

https://www.jetbrains.com/help/phpstorm/using-php-code-sniffer.html#installing-configuring-code-sniffer

Note: We would also suggest enabling PHP Mess Detector validation as well. Note: in case of using a Docker or VM, It needs to configure new PHPCS CLI Interpreter which will point out to VM/Docker.

Requirements

PHP 5.4 and up.

Checkout the php-5.3-compatible branch to get the PHP 5.3 version.

Contribution

Please feel free to contribute new sniffs or any fixes or improvements for the existing ones.


All versions of coding-standard with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1 || ^8.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 magento-ecg/coding-standard contains the following files

Loading the files please wait ....