{
    "url": "https://delaparra-services.nl/skills/spatie-laravel-php",
    "locale": "en",
    "title": "Spatie Laravel & PHP Guidelines | DeLaParra Services",
    "description": "Apply Spatie's Laravel and PHP coding standards for any task that creates, edits, reviews, refactors, or formats Laravel/PHP code or Blade templates; use for controllers, Eloquent models, routes, config, validation, migrations, tests, and related files to align with Laravel conventions and PSR-12.",
    "alternates": {
        "en": "https://delaparra-services.nl/skills/spatie-laravel-php",
        "nl": "https://delaparra-services.nl/nl/skills/spatie-laravel-php"
    },
    "formats": {
        "csv": "https://delaparra-services.nl/skills/spatie-laravel-php.csv",
        "md": "https://delaparra-services.nl/skills/spatie-laravel-php.md",
        "json": "https://delaparra-services.nl/skills/spatie-laravel-php.json",
        "zip": "https://delaparra-services.nl/skills/spatie-laravel-php.zip",
        "pdf": "https://delaparra-services.nl/skills/spatie-laravel-php.pdf"
    },
    "downloads": [
        {
            "url": "https://delaparra-services.nl/skills/spatie-laravel-php.csv",
            "encodingFormat": "text/csv",
            "name": "spatie-laravel-php.csv"
        },
        {
            "url": "https://delaparra-services.nl/skills/spatie-laravel-php.json",
            "encodingFormat": "application/json",
            "name": "spatie-laravel-php.json"
        },
        {
            "url": "https://delaparra-services.nl/skills/spatie-laravel-php.md",
            "encodingFormat": "text/markdown",
            "name": "spatie-laravel-php.md"
        },
        {
            "url": "https://delaparra-services.nl/skills/spatie-laravel-php.pdf",
            "encodingFormat": "application/pdf",
            "name": "spatie-laravel-php.pdf"
        },
        {
            "url": "https://delaparra-services.nl/skills/spatie-laravel-php.zip",
            "encodingFormat": "application/zip",
            "name": "spatie-laravel-php.zip"
        },
        {
            "url": "https://delaparra-services.nl/skills/spatie-laravel-php/download",
            "encodingFormat": "application/zip",
            "name": "spatie-laravel-php-files.zip"
        }
    ],
    "markdown": "# Spatie Laravel & PHP Guidelines\n\n \n\nApply Spatie's Laravel and PHP coding standards for any task that creates, edits, reviews, refactors, or formats Laravel/PHP code or Blade templates; use for controllers, Eloquent models, routes, config, validation, migrations, tests, and related files to align with Laravel conventions and PSR-12.\n\n \n\n**Licence** MIT\n\n \n\n**Source** spatie/guidelines-skills\n\n [Download zip](<https://delaparra-services.nl/skills/spatie-laravel-php/download>)   \n\n# Spatie Laravel & PHP Guidelines\n\n \n\n## Overview\n\n \n\nApply Spatie's Laravel and PHP guidelines to keep code style consistent and Laravel-native.\n\n \n\n## When to Activate\n\n \n\n- Activate this skill for any Laravel or PHP coding work, even if the user does not explicitly mention Spatie. \n- Activate this skill when asked to generate, edit, format, refactor, review, or align Laravel/PHP code. \n- Activate this skill when working on ` .php ` or ` .blade.php ` files, routes, controllers, models, config, validation, migrations, or tests.\n\n \n\n## Scope\n\n \n\n- In scope: ` .php `, ` .blade.php `, Laravel conventions (routes, controllers, config, validation, migrations, tests). \n- Out of scope: JS/TS, CSS, infrastructure, database schema design, non-Laravel frameworks.\n\n \n\n## Workflow\n\n \n\n1. Identify the artifact (controller, route, config, model, Blade, test, etc.). \n1. Read ` references/spatie-laravel-php-guidelines.md ` and focus on the relevant sections. \n1. Apply the core Laravel principle first, then PHP standards, then section-specific rules. \n1. If a rule conflicts with existing project conventions, follow Laravel conventions and keep changes consistent.\n\n \n\n## Core Rules (Summary)\n\n \n\n- Follow Laravel conventions first. \n- Follow PSR-1, PSR-2, and PSR-12. \n- Prefer typed properties and explicit return types (including ` void `). \n- Use short nullable syntax like ` ?string `. \n- Use constructor property promotion when all properties can be promoted. \n- One trait per line with separate ` use ` statements. \n- Once a method chain breaks across lines, put every subsequent ` -> ` on a new line; never mix single-line and multi-line chaining. \n- Prefer early returns and avoid ` else ` when possible. \n- Always use curly braces for control structures. \n- Use string interpolation over concatenation. \n- Happy path last: handle error conditions first.\n\n \n\n## Do and Don't\n\n \n\nDo:\n\n \n\n- Use kebab-case URLs, camelCase route names, and camelCase route parameters. \n- Use tuple notation for routes: ` [Controller::class, 'method'] `. \n- Use plural resource names for controllers (` PostsController `). \n- Use array notation for validation rules. \n- Use ` config() ` helper and avoid ` env() ` outside config files. \n- Add service configs to ` config/services.php `, not new files. \n- Use ` __() ` for translations instead of ` @lang `. \n- Use PascalCase for enum values and class constants.\n\n \n\nDon't:\n\n \n\n- Add docblocks when full type hints already exist. \n- Use fully qualified classnames in docblocks. \n- Use ` final ` or ` readonly ` by default. \n- Use ` else ` when early returns work. \n- Add spaces after Blade control structures.\n\n \n\n## Examples\n\n \n\n```\n// Happy path last with early returns\nif (! $user) {\n    return null;\n}\n\nif (! $user->isActive()) {\n    return null;\n}\n\n// Process active user...\n\n// Short ternary\n$name = $isFoo ? 'foo' : 'bar';\n\n// Constructor property promotion\nclass MyClass {\n    public function __construct(\n        protected string $firstArgument,\n        protected string $secondArgument,\n    ) {}\n}\n```\n\n \n\n```\n@if($condition)\n    Something\n@endif\n```\n\n \n\n## References\n\n \n\n- ` references/spatie-laravel-php-guidelines.md `\n\n \n\n## Files\n\n \n\n- ` LICENSE ` \n- ` SKILL.md ` \n- ` SOURCE.md ` \n- ` references/spatie-laravel-php-guidelines.md `\n\n \n\n## Related terms\n\n \n\n- [Abstract Factory](<https://delaparra-services.nl/knowledge-hub/abstract-factory>) \n- [Abstraction](<https://delaparra-services.nl/knowledge-hub/abstraction>) \n- [Adapter](<https://delaparra-services.nl/knowledge-hub/adapter>) \n- [Builder](<https://delaparra-services.nl/knowledge-hub/builder>) \n- [Class](<https://delaparra-services.nl/knowledge-hub/class>) \n- [Composite](<https://delaparra-services.nl/knowledge-hub/composite>) \n- [Decorator](<https://delaparra-services.nl/knowledge-hub/decorator>) \n- [Delegation](<https://delaparra-services.nl/knowledge-hub/delegation>) \n- [Dependency injection](<https://delaparra-services.nl/knowledge-hub/dependency-injection>) \n- [Encapsulation](<https://delaparra-services.nl/knowledge-hub/encapsulation>) \n- [Facade](<https://delaparra-services.nl/knowledge-hub/facade>) \n- [Factory Method](<https://delaparra-services.nl/knowledge-hub/factory-method>) \n- [Framework](<https://delaparra-services.nl/knowledge-hub/framework>) \n- [Function](<https://delaparra-services.nl/knowledge-hub/function>) \n- [Garbage collection](<https://delaparra-services.nl/knowledge-hub/garbage-collection>) \n- [Heap](<https://delaparra-services.nl/knowledge-hub/heap>) \n- [Idempotent](<https://delaparra-services.nl/knowledge-hub/idempotent>) \n- [Inheritance](<https://delaparra-services.nl/knowledge-hub/inheritance>) \n- [Middleware](<https://delaparra-services.nl/knowledge-hub/middleware>) \n- [Null](<https://delaparra-services.nl/knowledge-hub/null>) \n- [Object (Instance)](<https://delaparra-services.nl/knowledge-hub/object-instance>) \n- [Object-Oriented Programming (OOP)](<https://delaparra-services.nl/knowledge-hub/object-oriented-programming-oop>) \n- [Overhead](<https://delaparra-services.nl/knowledge-hub/overhead>) \n- [Polymorphism](<https://delaparra-services.nl/knowledge-hub/polymorphism>) \n- [Prototype](<https://delaparra-services.nl/knowledge-hub/prototype>) \n- [Proxy](<https://delaparra-services.nl/knowledge-hub/proxy>) \n- [Singleton](<https://delaparra-services.nl/knowledge-hub/singleton>) \n- [Stack](<https://delaparra-services.nl/knowledge-hub/stack>) \n- [Stateless](<https://delaparra-services.nl/knowledge-hub/stateless>) \n- [Static](<https://delaparra-services.nl/knowledge-hub/static>) \n- [Type checking](<https://delaparra-services.nl/knowledge-hub/type-checking>)\n\n \n\n[Installing an agent skill in Claude Code, Codex, Cursor and Copilot](<https://delaparra-services.nl/manuals/een-skill-installeren-in-je-ai-assistent>)\n\n[HTML version](https://delaparra-services.nl/skills/spatie-laravel-php)\n",
    "structured_data": {
        "@context": "https://schema.org",
        "@graph": [
            {
                "@type": "Organization",
                "@id": "https://delaparra-services.nl/#practice",
                "logo": "https://delaparra-services.nl/logo.png",
                "name": "DeLaParra Services",
                "legalName": "DeLaParra Services",
                "url": "https://delaparra-services.nl/",
                "description": "Bespoke software, web applications and mobile apps, developed in Laravel by a single developer in Groningen. Fixed price agreed in advance, full source code provided upon delivery.",
                "email": "info@delaparra-services.nl",
                "address": {
                    "@type": "PostalAddress",
                    "addressLocality": "Groningen",
                    "addressRegion": "Groningen",
                    "addressCountry": "NL"
                },
                "areaServed": "Groningen, the Netherlands",
                "knowsLanguage": [
                    "en",
                    "nl"
                ],
                "knowsAbout": [
                    "Web design and development",
                    "App development",
                    "Custom software and web applications",
                    "OpenSpec",
                    "AI code review",
                    "Your own coding agent"
                ],
                "founder": {
                    "@id": "https://delaparra-services.nl/#person"
                }
            },
            {
                "@type": "WebPage",
                "@id": "https://delaparra-services.nl/skills/spatie-laravel-php#webpage",
                "url": "https://delaparra-services.nl/skills/spatie-laravel-php",
                "name": "Spatie Laravel & PHP Guidelines | DeLaParra Services",
                "description": "Apply Spatie's Laravel and PHP coding standards for any task that creates, edits, reviews, refactors, or formats Laravel/PHP code or Blade templates; use for controllers, Eloquent models, routes, config, validation, migrations, tests, and related files to align with Laravel conventions and PSR-12.",
                "isPartOf": {
                    "@id": "https://delaparra-services.nl/#website"
                },
                "about": {
                    "@id": "https://delaparra-services.nl/#practice"
                },
                "inLanguage": "en",
                "breadcrumb": {
                    "@id": "https://delaparra-services.nl/skills/spatie-laravel-php#breadcrumb"
                }
            },
            {
                "@type": "BreadcrumbList",
                "@id": "https://delaparra-services.nl/skills/spatie-laravel-php#breadcrumb",
                "itemListElement": [
                    {
                        "@type": "ListItem",
                        "position": 1,
                        "name": "Home",
                        "item": "https://delaparra-services.nl/"
                    },
                    {
                        "@type": "ListItem",
                        "position": 2,
                        "name": "Spatie Laravel & PHP Guidelines"
                    }
                ]
            },
            {
                "@type": "Person",
                "@id": "https://delaparra-services.nl/#person",
                "name": "Reinier de la Parra",
                "url": "https://delaparra-services.nl/about"
            },
            {
                "@type": "SoftwareSourceCode",
                "@id": "https://delaparra-services.nl/skills/spatie-laravel-php#skill",
                "url": "https://delaparra-services.nl/skills/spatie-laravel-php",
                "name": "Spatie Laravel & PHP Guidelines",
                "description": "Apply Spatie's Laravel and PHP coding standards for any task that creates, edits, reviews, refactors, or formats Laravel/PHP code or Blade templates; use for controllers, Eloquent models, routes, config, validation, migrations, tests, and related files to align with Laravel conventions and PSR-12.",
                "inLanguage": "en",
                "license": "https://spdx.org/licenses/MIT.html",
                "subjectOf": {
                    "@id": "https://delaparra-services.nl/skills/spatie-laravel-php#dataset"
                }
            },
            {
                "@type": "Dataset",
                "@id": "https://delaparra-services.nl/skills/spatie-laravel-php#dataset",
                "name": "Spatie Laravel & PHP Guidelines",
                "description": "Apply Spatie's Laravel and PHP coding standards for any task that creates, edits, reviews, refactors, or formats Laravel/PHP code or Blade templates; use for controllers, Eloquent models, routes, config, validation, migrations, tests, and related files to align with Laravel conventions and PSR-12.",
                "url": "https://delaparra-services.nl/skills/spatie-laravel-php",
                "identifier": "https://delaparra-services.nl/skills/spatie-laravel-php#dataset",
                "about": {
                    "@id": "https://delaparra-services.nl/skills/spatie-laravel-php#skill"
                },
                "creditText": "spatie/guidelines-skills",
                "publisher": {
                    "@id": "https://delaparra-services.nl/#practice"
                },
                "license": "https://spdx.org/licenses/MIT.html",
                "isAccessibleForFree": true,
                "inLanguage": "en",
                "dateModified": "2026-11-28T14:00:12+00:00",
                "isPartOf": {
                    "@type": "Dataset",
                    "@id": "https://delaparra-services.nl/knowledge-hub#skills",
                    "name": "Skills for AI coding assistants",
                    "url": "https://delaparra-services.nl/knowledge-hub"
                },
                "includedInDataCatalog": {
                    "@type": "DataCatalog",
                    "@id": "https://delaparra-services.nl/knowledge-hub#catalog",
                    "name": "Knowledge hub data catalog",
                    "url": "https://delaparra-services.nl/knowledge-hub"
                },
                "distribution": [
                    {
                        "@type": "DataDownload",
                        "name": "spatie-laravel-php.csv",
                        "encodingFormat": "text/csv",
                        "contentUrl": "https://delaparra-services.nl/skills/spatie-laravel-php.csv",
                        "inLanguage": "en",
                        "dateModified": "2026-11-28T14:00:12+00:00",
                        "license": "https://spdx.org/licenses/MIT.html"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "spatie-laravel-php.json",
                        "encodingFormat": "application/json",
                        "contentUrl": "https://delaparra-services.nl/skills/spatie-laravel-php.json",
                        "inLanguage": "en",
                        "dateModified": "2026-11-28T14:00:12+00:00",
                        "license": "https://spdx.org/licenses/MIT.html"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "spatie-laravel-php.md",
                        "encodingFormat": "text/markdown",
                        "contentUrl": "https://delaparra-services.nl/skills/spatie-laravel-php.md",
                        "inLanguage": "en",
                        "dateModified": "2026-11-28T14:00:12+00:00",
                        "license": "https://spdx.org/licenses/MIT.html"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "spatie-laravel-php.pdf",
                        "encodingFormat": "application/pdf",
                        "contentUrl": "https://delaparra-services.nl/skills/spatie-laravel-php.pdf",
                        "inLanguage": "en",
                        "dateModified": "2026-11-28T14:00:12+00:00",
                        "license": "https://spdx.org/licenses/MIT.html"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "spatie-laravel-php.zip",
                        "encodingFormat": "application/zip",
                        "contentUrl": "https://delaparra-services.nl/skills/spatie-laravel-php.zip",
                        "inLanguage": "en",
                        "dateModified": "2026-11-28T14:00:12+00:00",
                        "license": "https://spdx.org/licenses/MIT.html"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "spatie-laravel-php-files.zip",
                        "encodingFormat": "application/zip",
                        "contentUrl": "https://delaparra-services.nl/skills/spatie-laravel-php/download",
                        "inLanguage": "en",
                        "dateModified": "2026-11-28T14:00:12+00:00",
                        "license": "https://spdx.org/licenses/MIT.html"
                    }
                ]
            }
        ]
    }
}