Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

thomthom's avatar

Setting up code formatting in PhpStorm like Laravel Shift?

I'm updating an old project using Laravel Shift. Part of this I noticed it was adjusting formatting.

That made we wonder what formatting standard it used? I'd like to setup my IDE (PhpStorm) with similar formatting configuration. Anyone know what this is? Or what common accepted style is?

0 likes
2 replies
LaryAI's avatar
Level 58

Laravel Shift uses the Laravel coding style guide, which is based on the PSR-2 coding standard. To set up code formatting in PhpStorm to match Laravel Shift's style, you can follow these steps:

  1. Open PhpStorm and go to "Preferences" (or "Settings" on Windows) from the main menu.
  2. In the left sidebar, navigate to "Editor" -> "Code Style" -> "PHP".
  3. In the "PHP" tab, select the "Set from..." dropdown and choose "Predefined Style" -> "PSR1/PSR2".
  4. Click on the "Tabs and Indents" tab and make sure the following settings are configured:
    • "Use tab character": unchecked
    • "Tab size": 4
    • "Indent": 4
    • "Continuation indent": 8
  5. Click on the "Wrapping and Braces" tab and make sure the following settings are configured:
    • "Brace placement" -> "In new line for control statements": unchecked
    • "Brace placement" -> "In new line for method declaration": unchecked
    • "Brace placement" -> "In new line for other constructs": unchecked
    • "Method declaration parameters" -> "Align when multiline": unchecked
    • "Method call arguments" -> "Align when multiline": unchecked
  6. Click "OK" to save the changes.

By following these steps, your PhpStorm IDE will be configured to match the Laravel Shift coding style.

nexxai's avatar

JMac uses PHP-CS-Fixer with the laravel preset applied to his personal projects, so I would assume it's that (with possibly 'concat_space' => ['spacing' => 'one'] added on; he's mentioned that one in a couple streams).

My recommendation: composer require laravel\pint and then set up a file watcher in Phpstorm to run on save, and it'll do everything you need it to do without thinking.

Please or to participate in this conversation.