PHPackages                             drupol/phpcsfixer-configs-drupal - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. drupol/phpcsfixer-configs-drupal

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

drupol/phpcsfixer-configs-drupal
================================

Base PHP CS Fixer configurations for Drupal 7 and 8.

2.2.0(1y ago)8281.0k↓43%5[2 issues](https://github.com/drupol/phpcsfixer-configs-drupal/issues)[1 PRs](https://github.com/drupol/phpcsfixer-configs-drupal/pulls)2MITPHPPHP &gt;= 8.0.0CI failing

Since Aug 13Pushed 1y ago2 watchersCompare

[ Source](https://github.com/drupol/phpcsfixer-configs-drupal)[ Packagist](https://packagist.org/packages/drupol/phpcsfixer-configs-drupal)[ GitHub Sponsors](https://github.com/drupol)[ Fund](https://www.paypal.me/drupol)[ RSS](/packages/drupol-phpcsfixer-configs-drupal/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (8)Versions (12)Used By (2)

[![Latest Stable Version](https://camo.githubusercontent.com/e4eb479f61097c4eae31e8acdc0d3cb7ad91186c5bfd2cd45da25d5c452030b0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f647275706f6c2f706870637366697865722d636f6e666967732d64727570616c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/drupol/phpcsfixer-configs-drupal)[![GitHub stars](https://camo.githubusercontent.com/9ad2d189d985e5ee03d99e2f4007678326f3a9ddeed89a0aa508d2f21cafe348/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f647275706f6c2f706870637366697865722d636f6e666967732d64727570616c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/drupol/phpcsfixer-configs-drupal)[![Total Downloads](https://camo.githubusercontent.com/a61d988e26106177a40dfeb091985f1706c82822070d60546114642d4adf6d71/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f647275706f6c2f706870637366697865722d636f6e666967732d64727570616c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/drupol/phpcsfixer-configs-drupal)[![License](https://camo.githubusercontent.com/fdba6e909a22c91740c726a97b62e38115cfbe4f033c596f0280a90827eabc26/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f647275706f6c2f706870637366697865722d636f6e666967732d64727570616c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/drupol/phpcsfixer-configs-drupal)[![Say Thanks!](https://camo.githubusercontent.com/05c3c1ff30c669596f087c84fa3128739d9a3c5ba0d3537ed0e41ad41553a04e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5361792d7468616e6b732d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://saythanks.io/to/drupol)[![Donate!](https://camo.githubusercontent.com/f2e288c194c16198351c80fcb396a39afb2ae2ccf89c1549c8dc049901151137/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f6e6174652d50617970616c2d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://paypal.me/drupol)

PHP CS Fixer Drupal Configurations
==================================

[](#php-cs-fixer-drupal-configurations)

Description
-----------

[](#description)

This package provides a set \[PHP-Cs-Fixer\]( CS Fixer) configuration objects ready to be used in a Drupal project.

Documentation
-------------

[](#documentation)

Available configuration objects:

- `drupol\PhpCsFixerConfigsDrupal\Config\Drupal7`
- `drupol\PhpCsFixerConfigsDrupal\Config\Drupal8`

Requirements
------------

[](#requirements)

- PHP &gt;= 8.0
- friendsofphp/php-cs-fixer &gt;= 3.35

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

[](#installation)

The recommended way to install PHP CS Fixer Drupal is to use Composer in a dedicated `composer.json` file in your project, for example in the `tools/php-cs-fixer` directory:

```
mkdir -p tools/php-cs-fixer
composer require --dev --working-dir=tools/php-cs-fixer drupol/phpcsfixer-configs-drupal
```

Or using the main `composer.json`:

```
composer require --dev drupol/phpcsfixer-configs-drupal
```

Configuration
-------------

[](#configuration)

Assuming you installed PHP CS Fixer as instructed above, you should now setup a configuration `.php-cs-fixer.php` file in the root directory of your project.

```
touch .php-cs-fixer.php
```

The example below setup PHP CS Fixer to use Drupal 8/9/10 rules:

```
