Not seeing how to get Laravel code style in PHPStorm

Posted 1 week ago by davestead

I've already brought this to the PHPStorm forum, and they either are having trouble figuring it out or the program's pre-defined styles aren't compliant or are buggy.

Laravel's documentation states: "Laravel follows the PSR-2 coding standard and the PSR-4 autoloading standard."

In PHPStorm > Preferences (Mac) > Editor > Code Style > PHP, there's nothing in there about Laravel, and I'm not finding where I could get this (I've already installed the Laravel Plugin), so I either have to manually configure it when I'm not familiar with all of the terminology (and it appears to be missing some necessary settings).

If I set Scheme to Project, then "Set from" to Predefined Style > PSR-1/PSR-2, it tosses function/for params on their own lines and separates parentheses on their own lines... it's not PSR-1/2 compliant and appears to be buggy.

Has someone made a Laravel 5.7 PSR-2/PSR-4-compliant code style configuration for PHPStorm? I'm using version 2018.3.2 right now, so if you've done this, please export it and attach it as a file somewhere so I can try this, or let me know how to make it compliant.

I'm really surprised nobody's made this automatically work in the most-popular PHP editor for the most-popular PHP framework.

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.