laravel-coding-standard

Enforce Laravel coding standards for naming, arrays, validation, and enums.

Updated Jul 13, 2023
One-click install
npx skills add https://github.com/changgenglu/changgenglu-blog --skill laravel-coding-standard
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-coding-standard
Source: https://github.com/changgenglu/changgenglu-blog/tree/main/prompt_engineering/gemini/skills/laravel-coding-standard
Command: npx skills add https://github.com/changgenglu/changgenglu-blog --skill laravel-coding-standard

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Laravel coding standards enforce consistent naming, formatting, and architectural guidelines across PHP projects to improve readability, maintainability, and collaboration. It focuses on semantic naming, array structure, validation rules formatting, and enum usage while ignoring indentation, whitespace, and other formatting concerns typically handled by linters.

Core Features & Use Cases

  • Naming conventions for variables, constants, classes, interfaces, and enums to ensure uniform coding style.
  • Array usage rules including short array syntax, trailing commas, and proper key-value formatting.
  • Validation rules structured as arrays instead of pipe-delimited strings for readability and tooling support.
  • Enum usage guidelines with labeled methods and option builders.
  • Layered architecture guidance separating controllers, services, and repositories to keep business logic out of controllers.

Quick Start

Apply these standards to a Laravel project by reviewing a sample controller for naming, array formatting, and validation structure.

Frequently Asked Questions about laravel-coding-standard

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce Laravel coding standards for PHP code reviews?

Enforce Laravel coding standards during PHP code reviews by checking naming conventions, array formatting, array-based validation rules, and enum structures to improve project readability and maintainability.

What's the best way to structure Laravel validation rules for maintainability?

Structure Laravel validation rules as arrays instead of pipe-delimited strings to enhance readability and provide better tooling support for maintaining consistent PHP code standards.

Does this coding standard check PHP array formatting and indentation?

This coding standard checks PHP array formatting like short syntax and trailing commas, but ignores indentation and whitespace concerns typically handled by dedicated linters.

How do I separate business logic from Laravel controllers?

Separate business logic from Laravel controllers by following layered architecture guidance that distinctively separates controllers, services, and repositories to ensure maintainable code.

What naming conventions should I use for Laravel enums and interfaces?

Use semantic naming conventions for variables, constants, classes, interfaces, and enums to ensure a uniform coding style across your Laravel PHP project modules.

Can I apply these PHP coding standards in a CI pipeline?

Apply these Laravel coding standards in CI pipelines to automatically enforce semantic naming, array structures, validation rules, and enum usage across your PHP project modules.