---
title: "Representing Money in PHP, Fowler-style"
url: https://daily.dev/posts/representing-money-in-php-fowler-style-nzdhd8kbc
source_url: https://verraes.net/2011/04/fowler-money-pattern-in-php
type: article
source: "Mathias Verraes"
published: 2026-06-17T11:25:42.438Z
updated: 2026-06-17T11:26:48.153Z
tags: ["php", "domain-driven-design"]
reading_time: 3
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Representing Money in PHP, Fowler-style

**[Mathias Verraes](https://daily.dev/sources/verraes)** · 3 min read · 0 upvotes · 0 comments

## Summary

A PHP implementation of Martin Fowler's Money pattern from Patterns of Enterprise Application Architecture (PoEAA). The library wraps monetary values in an immutable ValueObject that pairs amounts with currencies, preventing common bugs from shared object references. Key features include immutable arithmetic operations (add, subtract) and an allocation method that correctly distributes money across ratios without losing cents due to rounding — for example, splitting 5 cents 70/30 yields 4 and 1 cents rather than fractional values. The open source library is available on GitHub with unit tests demonstrating usage.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://verraes.net/2011/04/fowler-money-pattern-in-php>

## Similar posts on daily.dev

- [Mastering Value Objects in PHP 8.5\+ \(2026 Edition\)](https://daily.dev/posts/mastering-value-objects-in-php-8-5-2026-edition--lxspcwxig) · CodeCraft Diary · 2 upvotes · 3 comments

---

Tags: [#php](https://daily.dev/tags/php), [#domain-driven-design](https://daily.dev/tags/domain-driven-design)

[View this post on daily.dev](https://daily.dev/posts/representing-money-in-php-fowler-style-nzdhd8kbc)
