commerceguys / intl

A PHP internationalization library, powered by CLDR data.
MIT License
361 stars 45 forks source link

Rework the data model, start using value objects. #46

Closed bojanz closed 6 years ago

bojanz commented 6 years ago

Goal: Replace the Currency/Country/Language/NumberFormat objects with value objects (no setters). Remove each *EntityInterface.

Reason: Applications don't need us to dictate how their entities are going to look. And in many cases they might not have entities at all. Those that do can import the data from the library (using our repositories), provide their own entities, then provide their own repositories that load the data from the db and pass it to value objects. Basically, value objects are the envelope in which we put our data. This reduces friction by recuding the number of assumptions a library puts on the parent system.

The addressing library did this a year ago, with great results.