php-domain-modeling

php-domain-modeling is a skill for Claude Code, Codex from garrettw/php-arch-skills. It costs 55 tokens per session (3,075 once invoked), scanned A, original, MPL-2.0.

A guide for choosing how to structure business rules in a PHP application. It compares rich domain objects, simpler database entities, and several ways to organize logic based on the complexity and lifespan of the system.

In plain words
What is it for?
Use it when deciding between domain-driven design and simpler patterns such as transaction scripts or table modules, and when identifying meaningful business objects.
Why use it?
It helps avoid adding unnecessary architectural ceremony to simple applications and avoids under-structuring systems with many rules, states, or entry points.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when deciding between domain-driven design and simpler patterns such as transaction scripts or table modules, and when identifying meaningful business objects.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/garrettw/php-arch-skills/php-domain-modeling
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add garrettw/php-arch-skills --skill php-domain-modeling
Clone the repo
git clone --depth 1 https://github.com/garrettw/php-arch-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for php-domain-modeling

README.md
[![agentmods](https://agentmods.dev/badge/skills/garrettw/php-arch-skills/php-domain-modeling/github.svg)](https://agentmods.dev/skills/garrettw/php-arch-skills/php-domain-modeling)
Your own site
<a href="https://agentmods.dev/skills/garrettw/php-arch-skills/php-domain-modeling"><img src="https://agentmods.dev/badge/skills/garrettw/php-arch-skills/php-domain-modeling/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for php-domain-modeling

Your own site · 80×15
<a href="https://agentmods.dev/skills/garrettw/php-arch-skills/php-domain-modeling"><img src="https://agentmods.dev/badge/skills/garrettw/php-arch-skills/php-domain-modeling.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 55 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,075 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00055 $0.03075
Opus 5.5 $0.00022 $0.01230
Sonnet 5.5 $0.00011 $0.00615
Haiku 4.5 $0.00006 $0.00308

Measured 13d ago against content hash 3e519718aecf, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

php-domain-modeling scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 13d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/php-domain-modeling/SKILL.md · 122 lines

How it starts

The opening of the file, as written. The whole thing — 122 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Domain Modeling for PHP Apps

When to Use (and When NOT to)

DDD adds ceremony that must justify its cost. Use DDD when the domain is complex — many rules, invariants, and state transitions — and the system will be maintained for years. Skip DDD for throwaway prototypes and for simple CRUD with few business rules. When the signals below disagree, complexity and lifespan decide; the others only adjust how much ceremony is worth it.

Use DDD For Use Simpler Patterns For
Complex business domain with many invariants Simple CRUD, few business rules
Long-lived system, including its first release Throwaway prototype or spike
Multiple entry points (API, CLI, events) Single entry point, simple API
Need to swap infrastructure (DB, broker) Fixed infrastructure, unlikely to change
High test coverage required Quick scripts, internal tools

Team size is not a reason to skip DDD in a complex domain: a solo developer — especially one working with AI agents — benefits from explicit rules and boundaries as much as a team does. It does change how much enforcement and formality pay off (see bounded-contexts).

Start simple. Evolve complexity only when needed. Most systems do not need full DDD. For libraries, packages, or SDKs that have no user-facing behavior, plain PSR-4 classes with clear names are usually sufficient. For simple CRUD, lean ORM entities are preferable to rich domain objects.

Note: the choices below (Transaction Script, Table Module, Domain Model) are about how business rules are organized. The Application (or Service) Layer sits above this spectrum — it defines the application's boundary and coordinates whichever domain-logic style you pick. See the application-layer skill for Service Layer definition and the overuse anti-pattern (Controller → Service → Repository → Entity with an anemic domain).

Read the full file on GitHub · 122 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 13d ago First seen · 122 lines · 55 tokens per session scan A 3e519718aecf

Subscribe to this mod's changes

php-domain-modeling is a skill published in the GitHub repository garrettw/php-arch-skills (17 stars, last pushed 13d ago), licensed MPL-2.0. It adds 55 tokens to every session and 3,075 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-18.

Related

php-domain-modeling compared with skills from other repositories

php-domain-modeling next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
php-domain-modelinggarrettw/php-arch-skillsSkill1713d agoMPL-2.0A55Claude Code, Codex
bitrix-console-commandsbxmaximum/bitrix-framework-skillsSkill7513d agoMITA55Claude Code, Codex
bitrix-componentsbxmaximum/bitrix-framework-skillsSkill7513d agoMITA58Claude Code, Codex
bitrix-http-clientbxmaximum/bitrix-framework-skillsSkill7513d agoMITA59Claude Code, Codex
bitrix-request-responsebxmaximum/bitrix-framework-skillsSkill7513d agoMITA57Claude Code, Codex
bun-apidmythro/agent-skillsSkill719d agoMITA265Claude Code, Codex
laravelarbazkhan971/godmodeSkill353mo agoMITA52Claude Code