Preface
Bad habits
- Growth issues
- Extraction the logic
- The “simplicity” of REST
- PHP dark magic
- “Rapid” application development
- Premature optimization
- Saving LOC
- Other sources of pain
Dependency Injection
- Single Responsibility Principle
- Dependency Injection
- Inheritance
- Example with image uploading
- Extending interfaces
- Traits
- Static methods
- A few words at the end of the chapter
Painless refactoring
- “Static” typing
- Templates
- Model fields
- Laravel Idea
Application Layer
- Passing request data
- Working with database
- Service classes or command classes?
- A few words at the end of the chapter
Error handling
- Exceptions
- Base exception class
- Global handler
- Checked and unchecked exceptions
- A few words at the end of the chapter
Validation
- Database-related validation
- Two levels of validation
- Validation with attributes
- Value objects
- Value object as a composition of values
- Value objects and validation
- A few words at the end of the chapter
Events
- Database transactions
- Queues
- Events
- Using Eloquent events
- Entities as event class fields
- A few words at the end of the chapter
Unit testing
- First steps
- Testing stateful classes
- Testing classes with dependencies
- Types of software testing
- Testing in Laravel
- Application layer unit testing
- Application testing strategy
Domain Layer
- When and why?
- Domain layer implementation
- Handling errors in the Domain layer
- A few words at the end of the chapter
CQRS
- Different nature of data reading and writing
- A typical service class
- Command Query Responsibility Segregation
- A few words at the end of the chapter
Event sourcing
- The game of kings
- Unit-testing entities
- A world without magic
- Implementing ES
- A few words at the end of the chapter
Conclusion
- Classics
- Unit testing
- DDD
- ES and CQRS