labelworx / shift-styles
PHP code linter using Laravel Shift ruleset and PHP-CS-Fixer
Installs: 2 676
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
Requires
- friendsofphp/php-cs-fixer: ^2.0
- symfony/console: ^5.0
Requires (Dev)
- orchestra/testbench: ^3.0
- phpunit/phpunit: ^8.0
This package is auto-updated.
Last update: 2025-03-10 19:25:52 UTC
README
This package allows you to quickly run the Laravel Shift linter commands locally using php artisan shift
.
Using PHP CS Fixer and a ruleset created by Laravel Shift, this makes linting your Laravel project simple and adhere to "The Laravel Way".
Your can find the official ruleset used in this package in this gist.
Installation
You can install the ruleset via composer using the following command:
composer require --dev labelworx/shift-styles
Setup
This command will require a .php_cs.dist
configuration file for PHP CS Fixer to be available in your project root directory.
You can create this file using the command.
php artisan shift:setup
This file contains the default Laravel folder structure. These are the folders that will be scanned by PHP CS Fixer. You will need to add additional paths to this file if your project structure is different from that listed below.
A typical Laravel Project includes these directories:
<?php $finder = PhpCsFixer\Finder::create() ->in([ __DIR__ . '/app', __DIR__ . '/config', __DIR__ . '/database', __DIR__ . '/resources', __DIR__ . '/routes', __DIR__ . '/tests', ]); return Labelworx\styles($finder);
PHP CS Fixer uses a cache file to speed up usage. You are recommended that to add the .php_cs.cache
to you .gitignore
file.
Usage
To run and fix files -
php artisan shift
Resources
- Sharing PHP-CS-Fixer rules across projects and teams. Laravel News Article
- Laravel Shift Recommended Coding Ruleset. Gist - Shift