PHP code example of matt-allan / laravel-code-style

1. Go to this page and download the library: Download matt-allan/laravel-code-style 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/ */

    

matt-allan / laravel-code-style example snippets


// existing providers...
MattAllan\LaravelCodeStyle\ServiceProvider::class,



n (new MattAllan\LaravelCodeStyle\Config())
    ->setFinder(
        PhpCsFixer\Finder::create()
            ->in(app_path())
            // ...
            ->in('examples')
    )
    // ...


return (new MattAllan\LaravelCodeStyle\Config())
        ->setFinder(
            // ...
        )
        ->setRules([
            '@Laravel' => true,
            '@Laravel:risky' => true,
        ])
        ->setRiskyAllowed(true);

return (new MattAllan\LaravelCodeStyle\Config())
        ->setFinder(
            // ...
        )
        ->setRules([
            '@Laravel' => true,
            'no_unused_imports' => false,
        ]);
shell
php artisan vendor:publish --provider="MattAllan\LaravelCodeStyle\ServiceProvider"
shell
echo '.php_cs.cache' >> .gitignore
shell
vendor/bin/php-cs-fixer fix
shell
vendor/bin/php-cs-fixer fix --diff
shell
vendor/bin/php-cs-fixer fix --dry-run --diff
javascript
{
    // ...
    "scripts": {
        "check-style": "php-cs-fixer fix --dry-run --diff",
        "fix-style": "php-cs-fixer fix"
    }
}