GithubHelp home page GithubHelp logo

luigimassa / php-dev-tools Goto Github PK

View Code? Open in Web Editor NEW

This project forked from prestashop/php-dev-tools

0.0 0.0 0.0 143 KB

PHP Coding Standards for PrestaShop projects

License: MIT License

Shell 5.00% PHP 95.00%

php-dev-tools's Introduction

PrestaShop Coding Standards

Latest Stable Version Minimum PHP Version Quality Control Status

This repository includes tools to check that repositories are following the standards defined by the PrestaShop community and provides configuration files for some of them.

Related packages:

Installation

composer require --dev prestashop/php-dev-tools

When this project is successfully added to your dependencies, you can enable each review tool on your projet.

Version Guidance

Version Status Packagist - Namespace Repo Docs PHP Version
1.x EOL prestashop/php-dev-tools N/A v1.x N/A >=5.6,<7.2
2.x EOL prestashop/php-dev-tools N/A v2.x N/A >=5.6,<7.2
3.x Security fixes prestashop/php-dev-tools N/A v3.x N/A >=5.6,>=7.2.5
4.x Latest prestashop/php-dev-tools N/A v4.x N/A >=7.2.5

PHP Cs fixer

$ php vendor/bin/prestashop-coding-standards cs-fixer:init [--dest /path/to/my/project]

It'll create a configuration file .php-cs-fixer.dist.php in the root of your project.

Upgrade note : When upgrading from 4.1.0 to newer version, you should re-run the init script or rename your .php_cs.dist file to .php-cs-fixer.dist.php in order to match the new requirements of cs-fixer.

Phpstan

$ php vendor/bin/prestashop-coding-standards phpstan:init [--dest /path/to/my/project]

It'll create a default file phpstan.neon in tests/phpstan, that are required to run phpstan. The default phpstan level is the lowest available, but we recommend you to update this value to get more recommandations.

PHPStan is not provided by our dependencies, because of the PHP compatibility from projects using this repository. We recommend you to install it globally on your environment:

composer global require phpstan/phpstan:^0.12

Usage

The configuration files added in your project can be freely modified in order to match your needs.

Running the tools can be done by calling its binary:

PHP CS Fixer

$ vendor/bin/php-cs-fixer fix

PHPStan

If you have installed PHPStan globally and made the folder available in your PATH:

$ _PS_ROOT_DIR_=<Path_to_PrestaShop> phpstan --configuration=tests/phpstan/phpstan.neon analyse <path1 [path2 [...]]>

Otherwise, you can specify the path to the PHPStan binary. For instance:

$ _PS_ROOT_DIR_=<Path_to_PrestaShop> php ~/.composer/vendor/bin/phpstan.phar --configuration=tests/phpstan/phpstan.neon analyse <path1 [path2 [...]]>

Autoindex

Applying an index.php file to all your project subfolders will be useful to avoid directories to be listed by the webserver.

$ vendor/bin/autoindex

Header Stamp

Your license headers can be updated by applying the header stamp.

Here is an example of call, applying the default license on a PrestaShop module:

$ vendor/bin/header-stamp --license=assets/afl.txt --exclude=vendor,node_modules

Available options are provided with --help.

php-dev-tools's People

Contributors

ajenbo avatar intraordinaire avatar jmcollin avatar luigimassa avatar m-poulain avatar madsoliver avatar matks avatar pierrerambaud avatar progi1984 avatar quetzacoalt91 avatar sebsept avatar touxten avatar zalexki avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.