Skip to content

LiveIntent/php-cs-fixer

Repository files navigation

🍂 LiveIntent PHP code style rules

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package contains a code style linter for LiveIntent PHP projects. Under the hood it simply wraps php-cs-fixer, configures it with our agreed rule set, and adds some of our own custom rules.

Installation

You can install the package via composer:

composer require liveintent/php-cs-fixer

Usage

Create a .php-cs-fixer.dist.php file at the root of your project with the following contents:

<?php

$finder = Symfony\Component\Finder\Finder::create()
    ->in([
        __DIR__ . '/src',
        __DIR__ . '/tests',
    ])
    ->name('*.php')
    ->ignoreDotFiles(true)
    ->ignoreVCS(true);

return (new LiveIntent\PhpCsFixer\Config())->setFinder($finder);

Adjust the folders to analyze as needed.

Development

Clone this repository and install dependencies via:

composer install

Testing

You can run the tests via:

composer test

Linting

The installed linter will auto-format your code.

You can run it via:

composer lint