PHP code example of dvsa / coding-standards

1. Go to this page and download the library: Download dvsa/coding-standards 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/ */

    

dvsa / coding-standards example snippets


    
    $cacheFilename = '.php-cs-fixer.cache';

    $finder = PhpCsFixer\Finder::create()
        ->exclude('vendor')
        ->in(__DIR__);

    // Any additional project rules/rule sets.
    $additionalRules = [
        // Rule sets
        '@PHP80Migration:risky' => true,
        '@PHP81Migration' => true,
        '@Symfony' => true,
        '@Symfony:risky' => true,
        // Individual rules
        'protected_to_private' => false,
    ];

    return (new \Dvsa\PhpCodingStandards\PhpCsFixer\Config())($finder, $additionalRules, $cacheFilename);
    
shell 
    $ composer bin php-cs-fixer 
json
{
   "**/*.php": [
      "php ./vendor/bin/php-cs-fixer fix --diff --quiet",
      "php ./vendor/bin/phpcs --standard=./phpcs.dist.xml --report=diff --colors"
   ]
}