Domain-Driven Design in PHP

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

Domain-Driven Design in PHP

Carlos Buenosvinos, Christian Soronellas, Keyvan Akbary

1 customer reviews
Real examples written in PHP showcasing DDD Architectural Styles, Tactical Design, and Bounded Context Integration
Mapt Subscription
FREE
$29.99/m after trial
eBook
$28.00
RRP $39.99
Save 29%
Print + eBook
$49.99
RRP $49.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$28.00
$49.99
$29.99p/m after trial
RRP $39.99
RRP $49.99
Subscription
eBook
Print + eBook
Start 30 Day Trial

Frequently bought together


Domain-Driven Design in PHP Book Cover
Domain-Driven Design in PHP
$ 39.99
$ 28.00
JavaScript Domain-Driven Design Book Cover
JavaScript Domain-Driven Design
$ 31.99
$ 22.40
Buy 2 for $35.00
Save $36.98
Add to Cart
Subscribe and access every Packt eBook & Video.
 
  • 5,000+ eBooks & Videos
  • 50+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 

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
From 1 reviews

Read More Reviews

Recommended for You

JavaScript Domain-Driven Design Book Cover
JavaScript Domain-Driven Design
$ 31.99
$ 22.40
Getting Started with Microservices in PHP [Video] Book Cover
Getting Started with Microservices in PHP [Video]
$ 124.99
$ 106.25
Mastering PHP Design Patterns Book Cover
Mastering PHP Design Patterns
$ 35.99
$ 25.20
3D Printing Designs: Design an SD Card Holder Book Cover
3D Printing Designs: Design an SD Card Holder
$ 7.99
$ 5.60
Software Design Principles in Java [Integrated Course] Book Cover
Software Design Principles in Java [Integrated Course]
$ 124.99
$ 106.25
CMS Design Using PHP and jQuery Book Cover
CMS Design Using PHP and jQuery
$ 26.99
$ 18.90