oyova/php-cs-fixer

A wrapper for PHP CS Fixer.

Installs: 260

Dependents: 6

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 0

Type:project

v1.4.0 2023-09-30 22:36 UTC

This package is auto-updated.

Last update: 2024-04-30 00:28:43 UTC


README

This package is a wrapper for PHP CS Fixer. PHP CS Fixer is used to automatically fix PHP coding standards issues and this package establishes the preferred Oyova rules and simplifies setup.

Installation

Install the package via Composer:

composer require --dev oyova/php-cs-fixer

Setup

In the project root, create a file named .php-cs-fixer.php with the following code:

<?php

return (new Oyova\PhpCsFixer\Setup(__FILE__))
    // ->in(string|array)
    // ->exclude(string|array)
    // ->notName(string|array)
    ->getConfig();

For WordPress, use Oyova\PhpCsFixer\WordPressSetup instead of Oyova\PhpCsFixer\Setup.

Usage

From the project root, run the command vendor/bin/php-cs-fixer fix to fix all configured files or vendor/bin/php-cs-fixer fix path/to/file.php to fix a specific file or directory. Create a bash alias for the command for ease of use (e.g. alias phpfix='vendor/bin/php-cs-fixer fix').