DEV Community

Gabriel Anhaia profile picture

Gabriel Anhaia

Senior Software Engineer @ Monta · 10+ years in backend, distributed systems & AI agents · Creator of Hermes IDE (AI-native terminal) & Neural Playground · Author of 2 books · Open-source enthusiast

Location Berlin, Germany Joined Joined on  Personal website https://xgabriel.com github website

Work

Software Engineer and Book Author

Named Constructors in PHP: Why Order::place() Beats new Order(...)

Named Constructors in PHP: Why Order::place() Beats new Order(...)

Comments
8 min read
The Outbox Pattern in PHP from Scratch (No Library, 80 Lines)

The Outbox Pattern in PHP from Scratch (No Library, 80 Lines)

Comments
8 min read
Three Layers vs Four Layers: When the Application Layer Earns Its Keep

Three Layers vs Four Layers: When the Application Layer Earns Its Keep

Comments
8 min read
Schema Migrations vs Aggregate Evolution: Two Different Problems

Schema Migrations vs Aggregate Evolution: Two Different Problems

Comments
9 min read
Multi-Tenant Routing in Hexagonal PHP

Multi-Tenant Routing in Hexagonal PHP

Comments
10 min read
Pagination: Does It Belong in the Domain or in the Adapter?

Pagination: Does It Belong in the Domain or in the Adapter?

Comments
8 min read
ULID and UUID v7 in PHP: Modern IDs for Domain Entities

ULID and UUID v7 in PHP: Modern IDs for Domain Entities

Comments
9 min read
DTOs vs Value Objects: When to Use Which in PHP

DTOs vs Value Objects: When to Use Which in PHP

Comments
9 min read
Authorization in Use Cases, Not Controllers

Authorization in Use Cases, Not Controllers

Comments
8 min read
Where Input Validation Lives: Controllers, Use Cases, or Domain?

Where Input Validation Lives: Controllers, Use Cases, or Domain?

Comments
10 min read
Filament + Hexagonal: Building an Admin Panel Without Coupling Your Domain

Filament + Hexagonal: Building an Admin Panel Without Coupling Your Domain

Comments
8 min read
Symfony DependencyInjection for Hexagonal: Autowiring the Whole Domain

Symfony DependencyInjection for Hexagonal: Autowiring the Whole Domain

Comments
8 min read
PHP 8.4 Property Hooks for Value Objects: Beyond readonly

PHP 8.4 Property Hooks for Value Objects: Beyond readonly

Comments
9 min read
Enums as State Machines: Modeling Order Status the Right Way in PHP 8.3

Enums as State Machines: Modeling Order Status the Right Way in PHP 8.3

Comments
7 min read
Laravel Octane and Hexagonal: What Long-Lived Workers Actually Change

Laravel Octane and Hexagonal: What Long-Lived Workers Actually Change

Comments
8 min read
Mutation Testing as Architecture Enforcement: Infection in 2026

Mutation Testing as Architecture Enforcement: Infection in 2026

Comments
8 min read
Don't Mock What You Don't Own: The Stripe Adapter Pattern in PHP

Don't Mock What You Don't Own: The Stripe Adapter Pattern in PHP

Comments
10 min read
Property-Based Testing for Domain Rules in PHP

Property-Based Testing for Domain Rules in PHP

Comments
9 min read
Application Services vs Use Cases: The Actual Difference

Application Services vs Use Cases: The Actual Difference

Comments
8 min read
Why "Manager" Classes Are a Code Smell (And What to Replace Them With)

Why "Manager" Classes Are a Code Smell (And What to Replace Them With)

Comments
8 min read
Pessimistic vs Optimistic Locking in Hexagonal PHP

Pessimistic vs Optimistic Locking in Hexagonal PHP

Comments
9 min read
The Saga Pattern in PHP: Long-Running Workflows Without a Workflow Engine

The Saga Pattern in PHP: Long-Running Workflows Without a Workflow Engine

Comments
8 min read
Idempotency Keys in PHP: Stop Charging Customers Twice

Idempotency Keys in PHP: Stop Charging Customers Twice

Comments
9 min read
Tell, Don't Ask: The Rule That Decides Where Your PHP Methods Live

Tell, Don't Ask: The Rule That Decides Where Your PHP Methods Live

Comments
9 min read
Aggregate Roots: Why Your Entity Needs a Private Constructor in PHP

Aggregate Roots: Why Your Entity Needs a Private Constructor in PHP

Comments
8 min read
The Outer Ring: Why Your Framework Is Actually Replaceable

The Outer Ring: Why Your Framework Is Actually Replaceable

Comments
9 min read
Symfony Messenger as a Domain-Event Adapter (Without the Coupling)

Symfony Messenger as a Domain-Event Adapter (Without the Coupling)

Comments
8 min read
CQRS in PHP: When Reads and Writes Stop Being the Same Thing

CQRS in PHP: When Reads and Writes Stop Being the Same Thing

Comments
9 min read
The Specification Pattern in PHP: Querying Without Leaking SQL

The Specification Pattern in PHP: Querying Without Leaking SQL

Comments
9 min read
Stop Passing Eloquent Models to Blade

Stop Passing Eloquent Models to Blade

Comments
7 min read
Aggregates in PHP: The Boundary Most Teams Get Wrong

Aggregates in PHP: The Boundary Most Teams Get Wrong

Comments
9 min read
Domain Services in PHP: The Rare Class That Actually Belongs in Your Domain

Domain Services in PHP: The Rare Class That Actually Belongs in Your Domain

Comments
8 min read
DBAL Without an ORM: When a 50-Line Mapper Beats Doctrine

DBAL Without an ORM: When a 50-Line Mapper Beats Doctrine

Comments
9 min read
Pest vs PHPUnit for Use-Case Tests: Which One Hurts Less

Pest vs PHPUnit for Use-Case Tests: Which One Hurts Less

Comments
9 min read
Composer Autoloading for Hexagonal PHP: A Namespace Plan That Holds

Composer Autoloading for Hexagonal PHP: A Namespace Plan That Holds

Comments
9 min read
PSR-7 Is the Right Shape for Your HTTP Adapter, Even in Laravel

PSR-7 Is the Right Shape for Your HTTP Adapter, Even in Laravel

Comments
8 min read
Migrate Eloquent Models to Domain Entities Without a Big-Bang Rewrite

Migrate Eloquent Models to Domain Entities Without a Big-Bang Rewrite

Comments
8 min read
The Anti-Corruption Layer: Integrating Legacy PHP Without Catching Its Diseases

The Anti-Corruption Layer: Integrating Legacy PHP Without Catching Its Diseases

Comments
9 min read
If Your Controller Is More Than 15 Lines, You Have a Use Case Hiding

If Your Controller Is More Than 15 Lines, You Have a Use Case Hiding

Comments
7 min read
Bounded Contexts in PHP: Why Your App Should Be 4 Apps in One Codebase

Bounded Contexts in PHP: Why Your App Should Be 4 Apps in One Codebase

Comments
9 min read
The Complete Hexagonal Service in PHP: HTTP, CLI, Queue, DB, Tests

The Complete Hexagonal Service in PHP: HTTP, CLI, Queue, DB, Tests

Comments
10 min read
PHP 8.4 Asymmetric Visibility: The Feature That Finally Lets You Build Real Value Objects

PHP 8.4 Asymmetric Visibility: The Feature That Finally Lets You Build Real Value Objects

1
Comments
10 min read
The Strangler Pattern in PHP: Shipping Two Architectures at Once for a Year

The Strangler Pattern in PHP: Shipping Two Architectures at Once for a Year

Comments
10 min read
Migrating a Legacy Laravel Service to Hexagonal, Incrementally

Migrating a Legacy Laravel Service to Hexagonal, Incrementally

Comments
12 min read
When Hexagonal Architecture Is Overkill

When Hexagonal Architecture Is Overkill

Comments
11 min read
Observability Without Coupling: Logging, Tracing, and Metrics Through Ports

Observability Without Coupling: Logging, Tracing, and Metrics Through Ports

Comments
11 min read
Result Types in PHP: Stop Throwing Exceptions for Business Errors

Result Types in PHP: Stop Throwing Exceptions for Business Errors

Comments
8 min read
Domain Events in PHP Without a Kafka Cluster

Domain Events in PHP Without a Kafka Cluster

Comments
9 min read
Transactions Without Leaking the Database into Your Domain

Transactions Without Leaking the Database into Your Domain

Comments 1
11 min read
Testing Use Cases Without a Database (and Why Your Tests Are Slow)

Testing Use Cases Without a Database (and Why Your Tests Are Slow)

Comments
10 min read
Doctrine 3 Behind a Port: The Pattern That Lets You Swap ORMs

Doctrine 3 Behind a Port: The Pattern That Lets You Swap ORMs

Comments
10 min read
One Use Case, Three Entry Points: HTTP, CLI, and Queue Workers Sharing the Same Code

One Use Case, Three Entry Points: HTTP, CLI, and Queue Workers Sharing the Same Code

Comments
8 min read
Value Objects in PHP 8.3: Stop Passing Strings for Money

Value Objects in PHP 8.3: Stop Passing Strings for Money

Comments
9 min read
Anemic Domain, Fat Service: The PHP Antipattern Nobody Calls Out

Anemic Domain, Fat Service: The PHP Antipattern Nobody Calls Out

Comments
9 min read
Why "Service" Is the Worst Word in Your PHP Codebase

Why "Service" Is the Worst Word in Your PHP Codebase

Comments
9 min read
The Dependency Rule: The One Architecture Rule That Replaces 50 Others

The Dependency Rule: The One Architecture Rule That Replaces 50 Others

Comments
9 min read
Symfony Is Also an Adapter (Yes, Even With All Its Glue)

Symfony Is Also an Adapter (Yes, Even With All Its Glue)

Comments
9 min read
Laravel as an Adapter: A 90-Minute Refactor That Survives Framework Upgrades

Laravel as an Adapter: A 90-Minute Refactor That Survives Framework Upgrades

Comments
11 min read
Hexagonal vs Clean: When to Lean Which Way

Hexagonal vs Clean: When to Lean Which Way

Comments
9 min read
Clean Architecture's Four Rings, Translated to PHP

Clean Architecture's Four Rings, Translated to PHP

1
Comments
9 min read
loading...