php-essentials
PHP/Laravel product discipline — composer/phpunit, PSR-12 strict types, Eloquent parameterization, Docker-always services. Use when the product stack is php.
- License 许可
- MIT
- 最近更新
- 2026-10-20
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- php-essentials
- license
- MIT
- description
- PHP/Laravel product discipline — composer/phpunit, PSR-12 strict types, Eloquent parameterization, Docker-always services. Use when the product stack is php.
- compatibility
- opencode
03 SKILL.md 正文
What I do
- Keep PHP products consistent per PSR-12 and ECC PHP rules: strict types, tested, Docker-backed, no string-built SQL.
When to use me
Use on every task whose effective stack (task.stack ?? roadmap.stack, or workspace/composer.json) is php.
Rules
- Toolchain only:
composer install/require/php artisan <cmd>/php vendor/bin/phpunit(orvendor/bin/pestwhen the project uses Pest — never mix frameworks in one suite). Keep Composer scripts checked in so CI runs the same commands. - Verify:
php vendor/bin/phpunit(0 failures, including at least one error-path case per new behavior; collect--coverage-textwith pcov every run, <80% on new domain logic fails review) before exit; paste real output intoworkspace/TASK_PROGRESS.md. Separate fast unit tests from framework/DB integration tests; factories/builders over hand-written arrays; HTTP tests assert transport + validation, business rules live in service tests. - Style: PSR-12;
declare(strict_types=1); scalar + return type hints and typed properties everywhere;useimports for all classes (no global-namespace reliance); Laravel Pint or PHP-CS-Fixer + PHPStan/Psalm gate clean before exit. Immutable DTOs/value objects across service boundaries; exceptions for exceptional states (neverfalse/nullas hidden error channels); validated DTOs at the request boundary. - Laravel:
php artisan testOK as the runner; Eloquent/query-builder with bindings always (never concatenated SQL); forward-only migrations; factories + seeders for fixtures (never hand-rolled rows in tests). - Data access: config via env (
.envnever committed); connect to declared Docker services. No SQLite fallback layers — fail fast when a service is unreachable. - Layout:
app/+tests/(unit vs feature separated); never commitvendor/,.env, or coverage artifacts.
Depth (vendored ECC reference, MIT © 2026 Affaan Mustafa — read on demand)
vendor/ecc/rules/php/coding-style.md,patterns.md,security.md,testing.mdvendor/ecc/skills/laravel-patterns/SKILL.md,vendor/ecc/skills/laravel-tdd/SKILL.md- Review checklist:
vendor/ecc/agents/php-reviewer.md - Reloadable staged IDs:
ecc-laravel-patterns,ecc-laravel-tdd(skill tool, on-demand — staged by workflow/runner, never auto-injected)
04 同仓库更多 Skills
demo-skill
暂无简介
web-accessibility
WCAG 2.2 AA practice for keyboard, screen reader, contrast, and motion. Use when building or auditing user interfaces.
ui-conventions
Black/white token system, accessible components, and copy rules for frontend work. Use when building screens, components, or design tokens.
test-evidence
stack-toolchain test matrices, concurrency cases, and TASK_PROGRESS proof format for QA verification. Use when writing tests or proving deliverables work.
test-driven-development
RED-GREEN-REFACTOR cycle for new behavior. Use when implementing any feature, fix, or endpoint before writing production code.
systematic-debugging
Reproduce-isolate-fix-verify loop for defects and flaky behavior. Use when facing a bug, test failure, or unexpected behavior.