Domain-Driven Design in PHP

Real examples written in PHP showcasing DDD Architectural Styles, Tactical Design, and Bounded Context Integration

Domain-Driven Design in PHP

This ebook is included in a Mapt subscription
Carlos Buenosvinos, Christian Soronellas, Keyvan Akbary

Real examples written in PHP showcasing DDD Architectural Styles, Tactical Design, and Bounded Context Integration
$0.00
$39.99
$49.99
$29.99p/m after trial
RRP $39.99
RRP $49.99
Subscription
eBook
Print + eBook
Start 30 Day Trial
Subscribe and access every Packt eBook & Video.
 
  • 4,000+ eBooks & Videos
  • 40+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 
Code Files
Preview in Mapt

Book Details

ISBN 139781787284944
Paperback394 pages

Book Description

Domain-Driven Design (DDD) has arrived in the PHP community, but for all the talk, there is very little real code. Without being in a training session and with no PHP real examples, learning DDD can be challenging. This book changes all that. It details how to implement tactical DDD patterns and gives full examples of topics such as integrating Bounded Contexts with REST, and DDD messaging strategies. In this book, the authors show you, with tons of details and examples, how to properly design Entities, Value Objects, Services, Domain Events, Aggregates, Factories, Repositories, Services, and Application Services with PHP. They show how to apply Hexagonal Architecture within your application whether you use an open source framework or your own. They also cover how to integrate Bounded Contexts using REST frameworks and messaging strategies.

Table of Contents

Chapter 1: Getting Started with Domain-Driven Design
Why Domain-Driven Design Matters
The Three Pillars of Domain-Driven Design
Considering Domain-Driven Design
The Tricky Parts
Strategical Overview
Related Movements: Microservices and Self-Contained Systems
Wrap-Up
Chapter 2: Architectural Styles
The Good Old Days
Layered Architecture
Event Sourcing
Wrap-Up
Chapter 3: Value Objects
Definition
Value Object vs. Entity
Currency and Money Example
Characteristics
Basic Types
Testing Value Objects
Persisting Value Objects
Security
Wrap-Up
Chapter 4: Entities
Introduction
Objects Vs. Primitive Types
Identity Operation
Persisting Entities
Testing Entities
Validation
Entities and Domain Events
Wrap-Up
Chapter 5: Services
Application Services
Domain Services
Domain Services and Infrastructure Services
Testing Domain Services
Anemic Domain Models Vs Rich Domain Models
Wrap-Up
Chapter 6: Domain-Events
Introduction
Definition
Characteristics
Modeling Events
Doctrine Events
Persisting Domain Events
Publishing Events from the Domain Model
Spreading the news to Remote Bounded Contexts
Wrap-Up
Chapter 7: Modules
General Overview
Leverage Modules in PHP
Bounded Contexts and Applications
Structuring Code in Modules
Wrap-Up
Chapter 8: Aggregates
Introduction
Key Concepts
What Is an Aggregate?
Why Aggregates?
A Bit of History
Anatomy of an Aggregate
Aggregate Design Rules
Sample Application Service: User and Wishes
Transactions
Wrap Up
Chapter 9: Factories
Factory Method on Aggregate Root
Factory on Service
Testing Factories
Wrap-Up
Chapter 10: Repositories
Definition
Repositories Are Not DAOs
Collection-Oriented Repositories
Persistence-Oriented Repository
Querying Repositories
Managing Transactions
Testing Repositories
Testing Your Services with In-Memory Implementations
Wrap-Up
Chapter 11: Application
Requests
Anatomy of an Application Service
Testing Application Services
Transactions
Security
Domain Events
Command Handlers
Wrap-Up
Chapter 12: Integrating Bounded Contexts
Integration Through the Data Store
Integration Relationships
Implementing Bounded Context Integrations
Wrap-Up
Chapter 13: Hexagonal Architecture with PHP
Introduction
First Approach
Repositories and the Persistence Edge
Decoupling Business and Persistence
Migrating our Persistence to Redis
Decouple Business and Web Framework
Rating an Idea Using the API
Console App Rating
Testing Rating an Idea UseCase
Testing Infrastructure
Arggg, So Many Dependencies!
Domain Services and Notification Hexagon Edge
Let's Recap
Hexagonal Architecture
Key Points
What's Next?
Chapter 14: Bibliography
Chapter 15: The End

What You Will Learn

  • Correctly design all design elements of Domain-Driven Design with PHP
  • Learn all tactical patterns to achieve a fully worked-out Domain-Driven Design
  • Apply hexagonal architecture within your application
  • Integrate bounded contexts in your applications
  • Use REST and Messaging approaches

Authors

Table of Contents

Chapter 1: Getting Started with Domain-Driven Design
Why Domain-Driven Design Matters
The Three Pillars of Domain-Driven Design
Considering Domain-Driven Design
The Tricky Parts
Strategical Overview
Related Movements: Microservices and Self-Contained Systems
Wrap-Up
Chapter 2: Architectural Styles
The Good Old Days
Layered Architecture
Event Sourcing
Wrap-Up
Chapter 3: Value Objects
Definition
Value Object vs. Entity
Currency and Money Example
Characteristics
Basic Types
Testing Value Objects
Persisting Value Objects
Security
Wrap-Up
Chapter 4: Entities
Introduction
Objects Vs. Primitive Types
Identity Operation
Persisting Entities
Testing Entities
Validation
Entities and Domain Events
Wrap-Up
Chapter 5: Services
Application Services
Domain Services
Domain Services and Infrastructure Services
Testing Domain Services
Anemic Domain Models Vs Rich Domain Models
Wrap-Up
Chapter 6: Domain-Events
Introduction
Definition
Characteristics
Modeling Events
Doctrine Events
Persisting Domain Events
Publishing Events from the Domain Model
Spreading the news to Remote Bounded Contexts
Wrap-Up
Chapter 7: Modules
General Overview
Leverage Modules in PHP
Bounded Contexts and Applications
Structuring Code in Modules
Wrap-Up
Chapter 8: Aggregates
Introduction
Key Concepts
What Is an Aggregate?
Why Aggregates?
A Bit of History
Anatomy of an Aggregate
Aggregate Design Rules
Sample Application Service: User and Wishes
Transactions
Wrap Up
Chapter 9: Factories
Factory Method on Aggregate Root
Factory on Service
Testing Factories
Wrap-Up
Chapter 10: Repositories
Definition
Repositories Are Not DAOs
Collection-Oriented Repositories
Persistence-Oriented Repository
Querying Repositories
Managing Transactions
Testing Repositories
Testing Your Services with In-Memory Implementations
Wrap-Up
Chapter 11: Application
Requests
Anatomy of an Application Service
Testing Application Services
Transactions
Security
Domain Events
Command Handlers
Wrap-Up
Chapter 12: Integrating Bounded Contexts
Integration Through the Data Store
Integration Relationships
Implementing Bounded Context Integrations
Wrap-Up
Chapter 13: Hexagonal Architecture with PHP
Introduction
First Approach
Repositories and the Persistence Edge
Decoupling Business and Persistence
Migrating our Persistence to Redis
Decouple Business and Web Framework
Rating an Idea Using the API
Console App Rating
Testing Rating an Idea UseCase
Testing Infrastructure
Arggg, So Many Dependencies!
Domain Services and Notification Hexagon Edge
Let's Recap
Hexagonal Architecture
Key Points
What's Next?
Chapter 14: Bibliography
Chapter 15: The End

Book Details

ISBN 139781787284944
Paperback394 pages
Read More

Read More Reviews

Recommended for You

3D Printing Designs: Design an SD Card Holder Book Cover
3D Printing Designs: Design an SD Card Holder
$ 7.99
Design Patterns and Best Practices in Java 9 Book Cover
Design Patterns and Best Practices in Java 9
$ 35.99
CMS Design Using PHP and jQuery Book Cover
CMS Design Using PHP and jQuery
$ 26.99
Modernizing Legacy Applications in PHP Book Cover
Modernizing Legacy Applications in PHP
$ 35.99