mirror of
https://github.com/Jeuners/ECC.git
synced 2026-09-12 00:12:30 +02:00
feat: add php rule pack
This commit is contained in:
parent
0326442969
commit
ed366bddbb
12 changed files with 290 additions and 12 deletions
32
rules/php/patterns.md
Normal file
32
rules/php/patterns.md
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
paths:
|
||||
- "**/*.php"
|
||||
- "**/composer.json"
|
||||
---
|
||||
# PHP Patterns
|
||||
|
||||
> This file extends [common/patterns.md](../common/patterns.md) with PHP specific content.
|
||||
|
||||
## Thin Controllers, Explicit Services
|
||||
|
||||
- Keep controllers focused on transport: auth, validation, serialization, status codes.
|
||||
- Move business rules into application/domain services that are easy to test without HTTP bootstrapping.
|
||||
|
||||
## DTOs and Value Objects
|
||||
|
||||
- Replace shape-heavy associative arrays with DTOs for requests, commands, and external API payloads.
|
||||
- Use value objects for money, identifiers, date ranges, and other constrained concepts.
|
||||
|
||||
## Dependency Injection
|
||||
|
||||
- Depend on interfaces or narrow service contracts, not framework globals.
|
||||
- Pass collaborators through constructors so services are testable without service-locator lookups.
|
||||
|
||||
## Boundaries
|
||||
|
||||
- Isolate ORM models from domain decisions when the model layer is doing more than persistence.
|
||||
- Wrap third-party SDKs behind small adapters so the rest of the codebase depends on your contract, not theirs.
|
||||
|
||||
## Reference
|
||||
|
||||
See skill: `api-design` for endpoint conventions and response-shape guidance.
|
||||
Loading…
Add table
Add a link
Reference in a new issue