Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
spatie avatar

Spatie Laravel Php

  • 652 installs
  • 88 repo stars
  • Updated April 27, 2026
  • spatie/guidelines-skills

spatie-laravel-php is a context-activated coding standards skill that applies Spatie's Laravel and PHP conventions—including PSR-12, typed properties, and Blade rules—when developers create, edit, or review Laravel backe

About

spatie-laravel-php is Spatie's comprehensive Laravel and PHP guideline skill from the guidelines-skills package (MIT license), auto-activating when agents touch .php or .blade.php files, routes, controllers, models, config, validation, migrations, or tests. The package ships 4 skills total; this one enforces PSR-1, PSR-2, and PSR-12, typed properties, constructor promotion, early returns, kebab-case URLs, plural resource controllers, array validation notation, and Blade formatting rules via references/spatie-laravel-php-guidelines.md. Install through Laravel Boost (composer require spatie/guidelines-skills --dev; php artisan boost:install) or skills.sh (npx skills add spatie/guidelines-skills). Developers reach for it to keep AI-generated Laravel code aligned with battle-tested Spatie conventions without repeating style instructions every prompt.

  • spatie-laravel-php
  • AI & Agent Building
  • AI-coding skill

Spatie Laravel Php by the numbers

  • 652 all-time installs (skills.sh)
  • +34 installs in the week ending Jul 27, 2026 (Skillselion tracking)
  • Ranked #1,482 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
  • Data as of Jul 27, 2026 (Skillselion catalog sync)
npx skills add https://github.com/spatie/guidelines-skills --skill spatie-laravel-php

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs652
repo stars88
Last updatedApril 27, 2026
Repositoryspatie/guidelines-skills

How do you enforce Spatie Laravel PHP coding standards?

Helps with ai & agent building tasks.

Who is it for?

Laravel and PHP developers who want Spatie's production conventions applied automatically during AI-assisted coding and reviews.

Skip if: Teams on non-Laravel PHP frameworks or projects needing JavaScript, infrastructure, or database schema design guidance only.

When should I use this skill?

Agent works on Laravel or PHP files, or user asks to format, refactor, review, or align code with Spatie standards.

What you get

PSR-aligned PHP files, Laravel-native controllers and routes, consistent Blade templates, and convention-matched tests.

  • Convention-aligned PHP files
  • Formatted Blade templates
  • Laravel-native route and controller code

By the numbers

  • Package ships 4 guideline skills including spatie-laravel-php
  • References 3 PSR standards: PSR-1, PSR-2, and PSR-12

Files

SKILL.mdMarkdownGitHub ↗

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

1. Identify the artifact (controller, route, config, model, Blade, test, etc.). 2. Read references/spatie-laravel-php-guidelines.md and focus on the relevant sections. 3. Apply the core Laravel principle first, then PHP standards, then section-specific rules. 4. 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.
  • Use constructor property promotion when all properties can be promoted.
  • One trait per line with separate use statements.
  • Prefer early returns and avoid else when possible.
  • Always use curly braces for control structures.
  • Use string interpolation over concatenation.
  • Happy path last: handle error conditions first.

Do and Don't

Do:

  • Use kebab-case URLs, camelCase route names, and camelCase route parameters.
  • Use tuple notation for routes: [Controller::class, 'method'].
  • Use plural resource names for controllers (PostsController).
  • Use array notation for validation rules.
  • Use config() helper and avoid env() outside config files.
  • Add service configs to config/services.php, not new files.
  • Use __() for translations instead of @lang.
  • Use PascalCase for enum values.

Don't:

  • Add docblocks when full type hints already exist.
  • Use fully qualified classnames in docblocks.
  • Use final or readonly by default.
  • Use else when early returns work.
  • Add spaces after Blade control structures.
  • Write down methods in migrations, only up methods.

Examples

// Happy path last with early returns
if (! $user) {
    return null;
}

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

// Process active user...

// Short ternary
$name = $isFoo ? 'foo' : 'bar';

// Constructor property promotion
class MyClass {
    public function __construct(
        protected string $firstArgument,
        protected string $secondArgument,
    ) {}
}
@if($condition)
    Something
@endif

References

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

Related skills

How it compares

Pick this over generic PHP linters when you need opinionated Spatie Laravel conventions baked into agent context.

FAQ

Which file types trigger spatie-laravel-php?

spatie-laravel-php activates for .php and .blade.php work plus Laravel routes, controllers, models, config, validation, migrations, and tests. JavaScript, CSS, and infrastructure tasks are explicitly out of scope.

How do you install spatie-laravel-php?

Install spatie/guidelines-skills via Composer with Laravel Boost (composer require spatie/guidelines-skills --dev; php artisan boost:install) or run npx skills add spatie/guidelines-skills for skills.sh-compatible agents.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.