PHP code example of lin3s / php-cs-fixer-config

1. Go to this page and download the library: Download lin3s/php-cs-fixer-config library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lin3s / php-cs-fixer-config example snippets




/*
 * This file is part of the PhpCsFixerConfig project.
 *
 * Copyright (c) 2017-present LIN3S <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

use LIN3S\PhpCsFixerConfig\Lin3sConfig;

$config = new Lin3sConfig('LIN3S awesome project', '2017', 'project');
$config->getFinder()->in(__DIR__ . '/src');

$cacheDir = getenv('TRAVIS') ? getenv('HOME') . '/.php-cs-fixer' : __DIR__;

$config->setCacheFile($cacheDir . '/.php_cs.cache');

return $config;



/*
 * This file is part of the PhpCsFixerConfig project.
 *
 * Copyright (c) 2017-present LIN3S <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

use LIN3S\PhpCsFixerConfig\Lin3sConfig;

$config = new Lin3sConfig('LIN3S awesome project', '2017', 'project', true);
$config->getFinder()
    ->in(__DIR__ . '/spec')
    ->name('*Spec.php');

$cacheDir = getenv('TRAVIS') ? getenv('HOME') . '/.php-cs-fixer' : __DIR__;

$config->setCacheFile($cacheDir . '/.php_cs.cache');

return $config;
bash
/vendor
/.php_cs.cache
json
(...)

"scripts": {
    (...)

    "cs": [
        "php-cs-fixer fix --config=.php_cs -v",
        "php-cs-fixer fix --config=.phpspec_cs -v"
    ]
},
yml
cache:
  directories:
    - $HOME/.php-cs-fixer
yml
script:
  - vendor/bin/php-cs-fixer fix --config=.php_cs --verbose --diff --dry-run
  - vendor/bin/php-cs-fixer fix --config=.phpspec_cs --verbose --diff --dry-run