PHPackages                             badung7576/php\_cs\_precommit - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. badung7576/php\_cs\_precommit

ActiveComposer-plugin[Testing &amp; Quality](/categories/testing)

badung7576/php\_cs\_precommit
=============================

Check code php-cs-fixer and phpcpd before commit

00ShellCI failing

Since Jan 20Pushed 5y ago1 watchersCompare

[ Source](https://github.com/badung7576x/php_cs_precommit)[ Packagist](https://packagist.org/packages/badung7576/php_cs_precommit)[ RSS](/packages/badung7576-php-cs-precommit/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Php\_cs\_precommit
==================

[](#php_cs_precommit)

---

About
-----

[](#about)

Auto installed git pre-commit hook for running Php-cs-fixer and Phpcpd code checking to PSR2 coding standard compliance, duplicate code. It checks only files that are to be committed.

- Check code php-cs-fixer
- Check code phpcpd

---

Installation
------------

[](#installation)

Install `badung7576/php_cs_precommit` with composer require command:

```
$ composer require badung7576/php_cs_precommit
```

To enable code sniff, аdd to "post-install-cmd" and "post-update-cmd" in `composer.json` installation script:

```
"post-install-cmd": [
    "sh ./vendor/badung7576/php_cs_precommit/src/setup.sh"
],
"post-update-cmd": [
    "sh ./vendor/badung7576/php_cs_precommit/src/setup.sh"
]

```

Then run `composer install` or `composer update`. `pre-commit` hook will be installed or updated if it already exists.
Create simple file `.php_cs` in root directory project.
File `.php_cs` using to config rules checkcode php-cs-fixer.
**PHP-CS-Fixer has a lot of options and ways of config. You can read more it here: [PHP\_CS\_FIXER](https://github.com/FriendsOfPHP/PHP-CS-Fixer)**

```
