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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.