Laravel
Views
Use camelCase names (variables)
View files and directories MUST use camelCase.
resources/
views/
pages/
localGroups/
show.blade.php
createDiscussion.blade.php
Explicitly pass variables to partials and components
// GOOD
{{ $user->name }}
@include('welcome', ['user' => $user])
// BAD
{{ $user->name }}
@include('welcome')
Help your IDE
You SHOULD create and maintain PHPDoc blocks at the top of every view file. You MUST create and maintain PHPDoc blocks for components.
Add PHP injection using <?php and ?>. The @php and @endphp Blade directives pair looks better, but the tools we use (Psalm, Rector, PHPCS, PHP-CS-Fixer) can’t parse Blade syntax.
