PHP code example of phpcsstandards / phpcsutils

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

    

phpcsstandards / phpcsutils example snippets


// Get the PHPCS dir from an environment variable.
$phpcsUtilDir = getenv('PHPCSUtils_DIR');

// This may be a Composer install.
if ($phpcsUtilDir === false && file_exists(__DIR__ . '/vendor/autoload.php')) {
    $vendorDir    = __DIR__ . '/vendor';
    $phpcsUtilDir = $vendorDir . '/phpcsstandards/phpcsutils';

    // Load the Composer autoload file.
    
} else {
    echo 'Uh oh... can\'t find PHPCSUtils.

If you use Composer, please run `composer install`.
Otherwise, make sure you set a `PHPCSUtils_DIR` environment variable in your phpunit.xml file
pointing to the PHPCS directory.
';

    die(1);
}
bash
> composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
>