Design Guidelines

Consider some basic rules and typical issues to pay attention to when implementing modules:

  • Namespaces should be named in terms of Ubiquitous Language.
  • Don't name your namespaces based on patterns or building blocks (Value Objects, Services, Entities, and so on).
  • Create namespaces so that what's inside is as loosely coupled with other namespaces as possible.
  • Refactor namespaces the same way as your code. Move them, rename them, group them, extract them, and so on.
  • Don't use commercial product names, as they can change. Stick to the Ubiquitous Language.

We've placed the Order and the OrderLine Entities, the OrderLineWasAdded and the OrderWasCreated Event, and the OrderRepository into the same subfolder Domain/Model. This ...

Get Domain-Driven Design in PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.