2

I want some tools or Extension from which we can check coding stander of psr4

4 Answers 4

0

GrumPHP

GrumPHP will do it for you! This composer plugin will register some git hooks in your package repository. When somebody commits changes, GrumPHP will run some tests on the committed code. If the tests fail, you won't be able to commit your changes. This handy tool will not only improve your codebase, it will also teach your co-workers to write better code following the best practices you've determined as a team.

GrumPHP has a set of common tasks built-in. You will be able to use GrumPHP with a minimum of configuration.

Follow this link for more information Link

0

you can use magento-coding-standard tool as link given below.

https://github.com/magento/magento-coding-standard

0

Using github actions and a docker image you can do it with minimum effort

https://github.com/DominicWatts/StyleTest/blob/master/.github/workflows/php.yml#L10

name: PHPCS
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: PHPCS
      run: docker run --rm -v $PWD:/code:ro domw/phpcs phpcs --colors --standard=PSR12 --warning-severity=0 --report=full,summary,gitblame --extensions=php,phtml ./
      continue-on-error: true
    - name: compatibility
      run: docker run --rm -v $PWD:/code:ro domw/phpcompatibility phpcs --standard=PHPCompatibility --runtime-set testVersion 7.0-7.4 --colors --warning-severity=0 --report=full,summary --extensions=php,phtml ./

https://github.com/DominicWatts/phpcs

https://hub.docker.com/r/domw/phpcs

https://github.com/DominicWatts/StyleTest/runs/451666817

0

[on Debian]

sudo apt install php-codesniffer
then
phpcs -h

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.