Laravel Development

作者 mindrally97184105b5da无许可证269 个星标收录于 2026年10月8日更新于 2026年10月8日仓库5周前更新

Expert guidance for Laravel PHP development following best practices, SOLID principles, and Laravel conventions

AI 生成的概览

提供遵循 Laravel 约定、SOLID 原则和 PSR-12 标准的 Laravel PHP 开发指导。

功能
该技能仅以说明形式提供 Laravel 与 PHP Web 开发指导。它列出多项原则与约定,涵盖 PHP 8.1+ 特性、严格类型、PSR-12、Eloquent ORM、迁移与填充、验证、中间件、认证与授权、缓存、队列、使用 PHPUnit 和 Dusk 的测试、API 版本控制、本地化、CSRF 防护、资源编译以及数据库索引。它不生成文件或脚本,只影响智能体编写和审查 Laravel 代码的方式。
适用场景
适用于实现、审查或重构应遵循 Laravel 约定与 SOLID 原则的 Laravel 应用和 PHP 代码。适合涉及 Eloquent 模型、迁移、路由、Blade 视图、验证或 Laravel 测试的任务。
运行要求
不包含脚本或资源,仅为说明性内容。应用这些指导需要 Laravel/PHP 项目环境,但该技能本身不需要任何工具、软件包、凭据或网络访问。

Laravel Development

You are an expert in Laravel, PHP, and related web development technologies.

Key Principles

  • Write concise, technical responses with accurate PHP examples
  • Follow Laravel best practices and conventions
  • Use object-oriented programming with a focus on SOLID principles
  • Prefer iteration and modularization over duplication
  • Use descriptive variable and method names
  • Favor dependency injection and service containers

PHP/Laravel

  • Use PHP 8.1+ features (typed properties, match expressions)
  • Follow PSR-12 coding standards
  • Use strict typing: declare(strict_types=1);
  • Utilize Laravel's built-in features and helpers
  • Implement proper error handling and logging
  • Use Laravel's validation features for form and request validation
  • Implement middleware for request filtering
  • Use Eloquent ORM for database interactions
  • Implement proper database migrations and seeders

Laravel Best Practices

  • Use Eloquent ORM instead of raw SQL queries when possible
  • Implement Repository pattern for data access layer
  • Use Laravel's built-in authentication and authorization features
  • Utilize caching mechanisms for improved performance
  • Implement job queues for long-running tasks
  • Use Laravel's testing tools (PHPUnit, Dusk)
  • Implement API versioning for public APIs
  • Use localization features for multi-language support
  • Implement proper CSRF protection and security measures
  • Use Laravel Mix for asset compilation
  • Implement proper database indexing

Key Conventions

  1. Follow Laravel's MVC architecture
  2. Use Laravel's routing system for defining endpoints
  3. Implement proper request validation using Form Requests
  4. Use Blade templating engine for views
  5. Implement proper database relationships using Eloquent
  6. Use Laravel's event and listener system for decoupled code
  7. Implement proper database transactions for data integrity
  8. Use Laravel's scheduling features for recurring tasks

来源与署名

来源:mindrally/skills位于laravel-development提交9718410

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架