michael-rubel / laravel-value-objects Goto Github PK
View Code? Open in Web Editor NEWA bunch of general-purpose value objects you can use in your Laravel application.
License: MIT License
A bunch of general-purpose value objects you can use in your Laravel application.
License: MIT License
Are there any plans to add an Address
value object?
My surname is ‘Le Poidevin’ but this gets changed to just ‘Poidevin’.
$name = new FullName('Richard Le Poidevin');
dd($name->toArray());
//
array:3 [
"fullName" => "Richard Le Poidevin"
"firstName" => "Richard"
"lastName" => "Poidevin" // should be: Le Poidevin
]
It’s a tricky one, where should you break, always the first space? Some people may have multiple first names but I think that’s more likely to be hyphenated whilst surnames with ‘Le’ etc. are pretty common. It’s still better than what usually happens to my name - ‘Richard L’ 😅
Maybe the default behaviour should be firstName
is the first word and everything else forms lastName
?
According to the principles of DDD, Values object must be immutable, but here the constructor are public. So i can easily do this.
$test = new Text('value1');
$test->__construct('value2');
echo $test->value; // value2
Shouldn't you protect this method, and make it call from a static method like ValueObject::new($value)
?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.