spatie-laravel-php-standards

Spatie Laravel & PHP Guidelines

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "spatie-laravel-php-standards" with this command: npx skills add spatie/boost-spatie-guidelines/spatie-boost-spatie-guidelines-spatie-laravel-php-standards

Spatie Laravel & PHP Guidelines

Overview

Apply Spatie's Laravel and PHP guidelines to keep code style consistent and Laravel-native.

When to Activate

  • Activate this skill for any Laravel or PHP coding work, even if the user does not explicitly mention Spatie.

  • Activate this skill when asked to generate, edit, format, refactor, review, or align Laravel/PHP code.

  • Activate this skill when working on .php or .blade.php files, routes, controllers, models, config, validation, migrations, or tests.

Scope

  • In scope: .php , .blade.php , Laravel conventions (routes, controllers, config, validation, migrations, tests).

  • Out of scope: JS/TS, CSS, infrastructure, database schema design, non-Laravel frameworks.

Workflow

  • Identify the artifact (controller, route, config, model, Blade, test, etc.).

  • Read references/spatie-laravel-php-guidelines.md and focus on the relevant sections.

  • Apply the core Laravel principle first, then PHP standards, then section-specific rules.

  • If a rule conflicts with existing project conventions, follow Laravel conventions and keep changes consistent.

Core Rules (Summary)

  • Follow Laravel conventions first.

  • Follow PSR-1, PSR-2, and PSR-12.

  • Prefer typed properties and explicit return types (including void ).

  • Use short nullable syntax like ?string .

  • Prefer early returns and avoid else when possible.

  • Always use curly braces for control structures.

  • Use string interpolation over concatenation.

Do and Don't

Do:

  • Use kebab-case URLs, camelCase route names, and camelCase route parameters.

  • Use array notation for validation rules.

  • Use config() and avoid env() outside config files.

Don't:

  • Add docblocks when full type hints already exist.

  • Use fully qualified classnames in docblocks.

  • Use @lang instead of __() .

Examples

if (! $user) { return null; }

if (! $user->isActive()) { return null; }

$name = $isFoo ? 'foo' : 'bar';

@if($condition) Something @endif

References

  • references/spatie-laravel-php-guidelines.md

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

ray

No summary provided by upstream source.

Repository SourceNeeds Review
101-spatie
General

laravel-pdf

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

livewire-development

No summary provided by upstream source.

Repository SourceNeeds Review
196-spatie
Coding

pest-testing

No summary provided by upstream source.

Repository SourceNeeds Review