serendipity_hq/component-value-objects

A set of value objects to manage simple and composite values

6.0.0 2020-07-10 17:40 UTC

README

687474703a2f2f7777772e736572656e64697069747968712e636f6d2f6173736574732f6f70656e2d736f757263652d70726f6a656374732f4c6f676f2d536572656e64697069747948512d49636f6e2d546578742d507572706c652e706e67

Serendipity HQ Value Objects

A set of PHP Value Objects to manage simple and composite values.

68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736572656e6469706974795f68712f636f6d706f6e656e742d76616c75652d6f626a656374732e7376673f7374796c653d666c61742d737175617265 68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265 68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f736572656e6469706974795f68712f636f6d706f6e656e742d76616c75652d6f626a656374733f636f6c6f723d253233383839324246267374796c653d666c61742d737175617265266c6f676f3d706870 68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d253545332e342d3333333f7374796c653d666c61742d737175617265266c6f676f3d73796d666f6e79 68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d253545342e342d3333333f7374796c653d666c61742d737175617265266c6f676f3d73796d666f6e79 68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d253545352e312d3333333f7374796c653d666c61742d737175617265266c6f676f3d73796d666f6e79

68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53756767657374732d6578742d2d696e746c2d2532333838393242463f7374796c653d666c61742d737175617265266c6f676f3d706870 68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53756767657374732d646f637472696e652f6f726d2d2532333838393242463f7374796c653d666c61742d737175617265266c6f676f3d706870 68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53756767657374732d73796d666f6e792f666f726d2d2532333838393242463f7374796c653d666c61742d737175617265266c6f676f3d706870 68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53756767657374732d747769672f696e746c2d2d65787472612d2532333838393242463f7374796c653d666c61742d737175617265266c6f676f3d706870

Current Status

Coverage Maintainability Rating Quality Gate Status Reliability Rating Security Rating Technical Debt Vulnerabilities

Phan PHPStan PSalm PHPUnit Composer PHP CS Fixer Rector

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:

Supported features

ValueObject Doctrine Symfony
Embeddable Type Form Type Twig filter
Address
Currency N/A
CurrencyExchangeRate N/A N/A N/A N/A
Email N/A N/A N/A
IP N/A N/A N/A N/A
Money N/A
Payment
Phone
Tax
Uri
VAT Rate
VAT Number

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!