Shift with red gradient lettering

Customizing the code style

Configure Shift to apply your own custom code style.

Watch Next

Building tasks with the Workbench

Automate everyday code refactors using the Shift Workbench.

Configuring Shift

Configure Shifts behavior by adding a .shiftrc file.

Gaining confidence with tests

Pair Shift with tests for the most automation.

Transcript

Some Laravel Shifts automatically apply code style to your application code.

Doing so improves the automation within Shift by normalizing the code between new and old versions of core files.

By default, Shift applies the Laravel framework code style. Although Shift recommends adopting this code style, it may not follow your personal formatting preferences.

If you wish to control the code style applied, you may add a .php-cs-fixer.php file if you use PHP CS Fixer or a phpcs.xml file if you use PHP CodeSniffer.

No additional configuration is required. Shift will automatically detect the presence of this file and use it to apply your code style whenever it formats PHP code.

If you are not using one of these tools to automate formatting your code, Shift recommends using PHP CS Fixer version 3.x.

The latest PHP CS Fixer ruleset Shift uses is publicly available in a Gist. Feel free to use this as a starting point to create your own custom code style.

Sign in with any of the following services to connect Shift with your Laravel project.


Don't use one of these services?

Temporarily push your project to a free, private repository on one of these cloud-based services or upgrade your project locally with Shift for Docker.