Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

moai-lang-php

БесплатноБез исполняемых скриптовНе проверен

PHP 8.3+ development specialist covering Laravel 11, Symfony 7, Eloquent ORM, and modern PHP patterns. Use when developing PHP APIs, web applications, or…

modu-aiот modu-ai★ 69 звёзд на GitHub18 установок в других каталогах

Об этом скилле

Quick Reference (30 seconds)

PHP 8.3+ Development Specialist - Laravel 11, Symfony 7, Eloquent, Doctrine, and modern PHP patterns.

Auto-Triggers: PHP files with .php extension, composer.json, artisan command, symfony.yaml, Laravel or Symfony discussions

Core Capabilities:

  • PHP 8.3 Features: readonly classes, typed properties, attributes, enums, named arguments
  • Laravel 11: Controllers, Models, Migrations, Form Requests, API Resources, Eloquent
  • Symfony 7: Attribute-based routing, Doctrine ORM, Services, Dependency Injection
  • ORMs: Eloquent for Laravel, Doctrine for Symfony
  • Testing: PHPUnit, Pest, feature and unit testing patterns
  • Package Management: Composer with autoloading
  • Coding Standards: PSR-12, Laravel Pint, PHP CS Fixer
  • Docker: PHP-FPM, nginx, multi-stage builds

Quick Patterns

Laravel Controller Pattern:

In the App\Http\Controllers\Api namespace, create a UserController extending Controller. Import StoreUserRequest, UserResource, User, and JsonResponse. Define a store method accepting StoreUserRequest that creates a User using validated data and returns a JsonResponse with UserResource wrapping the user and status 201.

Laravel Form Request Pattern:

In the App\Http\Requests namespace, create a StoreUserRequest extending FormRequest. The authorize method returns true. The rules method returns an array with name requiring required, string, and max 255 validation, email requiring required, email, and unique on users table, and password requiring required, min 8, and confirmed validation.

Symfony Controller Pattern:

In the App\Controller namespace, create a UserController extending AbstractController. Import User, EntityManagerInterface, JsonResponse, and Route attribute. Apply Route attribute at class level for api/users path. Create a create method with Route attribute for empty path and POST method. Inject EntityManagerInterface, create new User, persist and flush, then return json response with user and status 201.


Implementation Guide (5 minutes)

PHP 8.3 Modern Features

Readonly Classes:

Declare a readonly class UserDTO with a constructor promoting public properties for int id, string name, and string email.

Enums with Methods:

Create an OrderStatus enum backed by string. Define cases Pending with pending value, Processing with processing value, and Completed with completed value. Add a label method that uses match expression on $this to return appropriate display labels for each case.

Attributes:

Create a Validate attribute class targeting properties with Attribute attribute. The constructor accepts a string rule and optional string message. Create a UserRequest class with email property decorated with Validate attribute specifying required and email rules.

Laravel 11 Patterns

Eloquent Model with Relationships:

In the App\Models namespace, create a Post model extending Model. Set protected fillable array with title, content, user_id, and status. Set protected casts array with status casting to PostStatus enum and published_at casting to datetime. Define a user method returning BelongsTo relationship. Define a comments method returning HasMany relationship. Add a scopePublished method that filters by published status.

API Resource Pattern:

In the App\Http\Resources namespace, create a PostResource extending JsonResource. The toArray method takes a Request parameter. Return an array with id, title, author using UserResource with whenLoaded for user relationship, comments_count using whenCounted, and created_at formatted as ISO 8601 string.

Migration Pattern:

Create an anonymous migration class extending Migration. The up method calls Schema create on posts table. Define id, foreignId for user_id with constrained and cascadeOnDelete, string for title, text for content, string for status defaulting to draft, timestamps, and softDeletes.

Service Layer Pattern:

In the App\Services namespace, create a UserService class. Define a create method accepting UserDTO. Use DB transaction wrapping User create with data from DTO properties, profile creation with default bio, and returning user with loaded profile relationship. Catch ActiveRecord\RecordInvalid exceptions to handle validation failures.

Symfony 7 Patterns

Entity with Doctrine Attributes:

In the App\Entity namespace, create a User class. Apply ORM\Entity attribute with repositoryClass pointing to UserRepository. Apply ORM\Table attribute with name users. Add private nullable int id with ORM\Id, ORM\GeneratedValue, and ORM\Column attributes. Add private nullable string name with ORM\Column length 255 and Assert\NotBlank. Add private nullable string email with ORM\Column length 180 unique and Assert\Email.

Service with Dependency Injection:

In the App\Service namespace, create a UserService class. The constructor accepts readonly EntityManagerInterface and readonly UserPasswordHasherInterface via property promotion. Define createUser method taking email and password strings. Create ne

Полный SKILL.md на GitHub

Установить moai-lang-php в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Grep
Glob
Bash(php:*)
Bash(composer:*)
Bash(phpunit:*)
Bash(phpstan:*)
Bash(phpcs:*)
Bash(artisan:*)
Bash(laravel:*)
mcp__context7__resolve-library-id
mcp__context7__get-library-docs

Вложенные файлы

modules/advanced-patterns.mdreferences/examples.mdreferences/reference.md

FAQ

Что делает скилл moai-lang-php?

PHP 8.3+ development specialist covering Laravel 11, Symfony 7, Eloquent ORM, and modern PHP patterns. Use when developing PHP APIs, web applications, or Laravel/Symfony projects.

Как установить скилл moai-lang-php?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл moai-lang-php запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить moai-lang-php с