PHP code example of janaseta / php-cs

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

    

janaseta / php-cs example snippets




return JanaSeta\PhpCs\Fix::in([
	// List directories where your PHP is
	'src',
]);

/* .php-cs-fixer.dist */


return JanaSeta\PhpCs\Fix::in([
	'src',
	'tests',
])->addRules([
	'braces' => true,
	'is_null' => false,
]);

/* .php-cs-fixer.dist */


// Create a Finder instance
$finder = PhpCsFixer\Finder::create()
	->in($folders); // Search however you need

$config = new JanaSeta\PhpCs\Config;

return $config
	->setIndent('    ') // Set any php-cs-fixer options that you desire
	->setFinder($finder);
sh
vendor/bin/php-cs-fixer fix --dry-run --diff
sh
vendor/bin/php-cs-fixer fix