Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Facile Coding Standard Laravel Package

facile-it/facile-coding-standard

PHP coding standard based on PHP-CS-Fixer by Facile.it. Installs via Composer with an interactive setup that generates a .php-cs-fixer.dist.php, auto-detects files from composer autoload (psr-0/psr-4/classmap), and adds cs-check/cs-fix scripts.

View on GitHub
Deep Wiki
Context7

Facile.it PHP Coding Standard

PHP Version Build status Code coverage

Latest Stable Version Total Downloads Latest Unstable Version License composer.lock

Repository with PHP coding standard ruleset, based on PHP-CS-Fixer.

Installation

Currently, Composer is the only supported installation tool.

$ composer require --dev facile-it/facile-coding-standard

When you install it, a plugin will ask you some questions to setup your project automatically.

The installer will add a .php-cs-fixer.dist.php file in your project root directory, then you can edit manually if you need some changes.

The CS config will be configured to find your project files using composer autoload sources.

Only psr-0, psr-4 and classmap autoloads are supported.

The installer will also add two scripts in your composer.json;

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

Configuration

The installation configuration should be enough to use it.

If you need to change the CS config file, we suggest to don't edit the main .php-cs-fixer.dist.php file.

You can create a new file .php-cs-fixer.php with something like this:

<?php

/** @var PhpCsFixer\Config $config */
$config = require __DIR__ . '/.php-cs-fixer.dist.php';

// change your configuration...
$config->setUsingCache(false);

return $config;

Usage

To start code style check:

$ composer cs-check

To automatically fix code style:

$ composer cs-fix

PhpCsFixer configuration

See PhpCsFixer GitHub page.

Risky rules

Risky rules may be unstable, and cause unintended behavioral changes to your code. If you want to add these rules, you can create your own .php-cs-fixer.php configuration:

<?php

/** @var \PhpCsFixer\Config $config */
$config = include __DIR__ . '/.php-cs-fixer.dist.php';

$rulesProvider = new Facile\CodingStandards\Rules\CompositeRulesProvider([
    new Facile\CodingStandards\Rules\DefaultRulesProvider(),
    new Facile\CodingStandards\Rules\RiskyRulesProvider(),
    new Facile\CodingStandards\Rules\ArrayRulesProvider([
        // additional rules or rules to override
    ]),
]);

$config->setRules($rulesProvider->getRules());

return $config;

Generate configuration

If you have any problem updating to a new version, you can regenerate the default .php-cs-fixer.dist.php with the command:

$ composer facile-cs-create-config
$ composer facile-cs-create-config --help

Usage:
  facile-cs-create-config [options]

Options:
      --no-dev                   Do not include autoload-dev directories
      --no-risky                 Do not include risky rules
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4