serendipity_hq / component-value-objects
A set of value objects to manage simple and composite values
Installs: 500 524
Dependents: 4
Suggesters: 0
Security: 0
Stars: 20
Watchers: 2
Forks: 1
Open Issues: 6
Requires
- php: ^7.4|^8.0
- darsyn/ip: ^4
- egulias/email-validator: ^2.1.10 || ^3.0.0 || ^4.0.0
- giggsey/libphonenumber-for-php: ^8.8
- laminas/laminas-uri: ^2.6.2
- moneyphp/money: ^3.3|^4.0
- thecodingmachine/safe: ^1.3|^2.0
Requires (Dev)
- ext-ast: *
- ext-bcmath: *
- bamarni/composer-bin-plugin: ^1.4
- dg/bypass-finals: ^1.1
- doctrine/dbal: ^2.5 | ^3.0
- doctrine/orm: ^2.5
- phpstan/phpstan: 1.10.62
- phpstan/phpstan-phpunit: 1.3.16
- rector/rector: 1.0.3
- roave/security-advisories: dev-master
- serendipity_hq/rector-config: ^1.0
- symfony/form: ^4.4|^5.4|^6.0
- symfony/var-dumper: ^4.4|^5.4|^6.0
- thecodingmachine/phpstan-safe-rule: 1.2.0
- twig/intl-extra: ^2.12|^3.0
- dev-dev
- 7.1.5
- 7.1.4
- 7.1.3
- 7.1.2
- 7.1.1
- 7.1.0
- 7.0.0
- 6.0.0
- 5.0.7
- 5.0.6
- 5.0.5
- 5.0.4
- 5.0.3
- 5.0.2
- 5.0.1
- 5.0.0
- 4.0.11
- 4.0.10
- 4.0.9
- 4.0.8
- 4.0.7
- 4.0.6
- 4.0.5
- 4.0.4
- 4.0.3
- 4.0.2
- 4.0.1
- 4.0.0
- 3.1.3
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.1
- 3.0.0
- 2.7.0
- 2.6.6
- 2.6.5
- 2.6.4
- 2.6.3
- 2.6.2
- 2.6.1
- 2.6.0
- 2.5.5
- 2.5.4
- 2.5.3
- 2.5.2
- 2.5.1
- 2.5.0
- 2.4.4
- 2.4.3
- 2.4.2
- 2.4.1
- 2.4.0
- 2.3.2
- 2.3.1
- 2.3.0
- 2.2
- 2.1.2
- 2.1.1
- 2.1
- 2.0.3.1
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3
- 1.2.0
- 1.1
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3
- 0.2.1
- 0.2
- dev-dependabot/composer/vendor-bin/phpunit/dev/symfony/phpunit-bridge-7.1.6
- dev-master
- dev-release/7.1.5
This package is auto-updated.
Last update: 2024-10-28 08:05:19 UTC
README
Serendipity HQ Value Objects
A set of PHP Value Objects to manage simple and composite values.
Current Status
Features
It supports SimpleValueObjects
and ComplexValueObjects
.
Complex value objects are hydrated passing an array. If a key of the array isn't recognized as property of the object it
is added to the $otherData
array so it isn't lost.
Some of those value objects support also the persistence in Doctrine providing custom mapping types (See below).
Do you like this library?
LEAVE A ★
or run
composer global require symfony/thanks && composer thanks
to say thank you to all libraries you use in your current project, this included!
What are Value Objects
Value Objects are PHP objects
that represent and manage simple
or complex values. Once set, the value object cannot be modified without changing its identity.
Simple value objects represent a simple value, like an email. Complex value objects represent complex values, that, in order to really represent a value, need more than one value, like a price that needs an amount and a currency to be understandable and have a sense.
PHP supports only one value object: the DateTime
object.
This library gives support for other kind of values, differentiating them between complex and simple.
To better understand the concepts behind the value objects, you can read this post.
Install component-value-objects via Composer
$ composer require serendipity_hq/component-value-objects
This library follows the http://semver.org/ versioning conventions.
Instructions to install Intl PHP extension in MAMP for Mac
Available Value Objects
Currently, this library supports the following Value Objects:
- Address: Built-in. A more advanced value object is
commerceguys/addressing
(but it more suited for shipping addresses than for addresses themself); - CurrencyExchangeRate: Built-in;
- Email: A basic class derived from Wowo's gist EmailValueObject. It implements `egulias/email-validator to validate emails;
- IP: Just a proxy for the library
darsyn/ip
; - Money: Just a proxy for the library
moneyphp/money
; - Payment: Built-in
- Phone: Just a proxy for the library
giggsey/libphonenumber-for-php
; - Tax: Built-in
- Uri: Just a proxy for the library
Laminas\Uri
(formerly Zend Uri). A more advanced value object isLeague\Uri
- VatRate: Built-in
- VatNumber: Built-in
Supported features
Do you like this library?
LEAVE A ★
or run
composer global require symfony/thanks && composer thanks
to say thank you to all libraries you use in your current project, this included!