mxrvx/code-style

Code style and static analysis tools rulesets collection

v1.0.0 2025-04-10 09:56 UTC

This package is auto-updated.

Last update: 2025-04-17 13:46:12 UTC


README

This repository contains ruleset for PHP CS Fixer based on PER-2.

Installation and configuration

Install the package via composer:

composer require --dev mxrvx/code-style

PHP Latest Version on Packagist License Total Downloads

Create a configuration file .php-cs-fixer.dist.php in the root of your project:

<?php

declare(strict_types=1);

require_once 'vendor/autoload.php';

return \MXRVX\CodeStyle\Builder::create()
    ->include(__DIR__ . '/src')
    ->include(__FILE__)
    ->build();

Feel free to adjust the paths to include/exclude files and directories.

Usage

To more convenient usage, you can add the following commands to the scripts section of the composer.json file:

{
    "scripts": {
        "cs:diff": "php-cs-fixer fix --dry-run -v --diff",
        "cs:fix": "php-cs-fixer fix -v"
    }
}

Now you can run the following commands:

composer cs:diff
composer cs:fix