Skip to content

Domain

Domain is a Laravel-aware business capability shared across Services and independent of delivery concerns.

Generated facts

Layer
domain
Generated path
app/Pulsar/Domain/{Domain}
Generator command
make:domain
Workflow method
None
Stability
Current manifest surface (Pulsar 0.4.1)

Canonical example

Generated src/stubs/context.stub — canonical synchronized stub.

app/Pulsar/Domain/{Domain}/
├── Contracts/      # Domain-owned capability ports
├── Models/         # Eloquent models
├── Actions/        # Atomic business operations
├── Queries/        # Complex read operations
├── DTOs/           # Data transfer objects
├── ValueObjects/    # Immutable validated domain primitives
├── Policies/       # Authorization
├── Events/         # Domain events
├── Listeners/      # Synchronous or queued domain reactions
├── Notifications/  # Domain outbound notifications
├── Mail/           # Domain outbound mailables
├── Enums/          # Business states
└── Exceptions/     # Business rule violations

Responsibility

Domain owns the responsibility stated above; it must not absorb delivery, transaction, or unrelated cross-layer behavior.

Placement and dependencies

Keep this type in its generated Domain path. Domain is independent of delivery concerns; Infrastructure implements Domain-owned Contracts at its boundary.

Workflow and tests

Domain is consumed by the owning Domain or Service workflow and returns a delivery-neutral result. Test its direct contract, its rejected boundary cases, and the caller or callee that proves the rule in application flow.

Three pitfalls

  1. ❌ Prohibited: move this responsibility into a neighboring type merely because it is nearby.
  2. ✅ Correct: keep the generated placement and depend only on the documented layer direction.
  3. ✅ Correct: test the boundary through the caller and the return or side effect visible to its callee.

Related reading

Read architecture placement for shared rationale and follow this page’s related concept links for the adjacent responsibility.

Boundaries

❌ Prohibited: Do not import Service delivery types into Domain.

✅ Correct: Keep business capability in Domain while allowing its Laravel-native Model and Policy dependencies.