mediagone / common-types
A collection of Value Objects you should (always) use instead of primitive types!
Installs: 69
Dependents: 2
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/mediagone/common-types
Requires
- php: ^7.4|^8.0
- ext-json: *
- ext-mbstring: *
Requires (Dev)
- phpunit/phpunit: ^9.0
README
Value Objects are small and immutable classes representing typed values usually implemented using PHP primitive types. However, objects can embed validation to ensure that your data is always valid without adding any check elsewhere in your code.
That's why you should ALWAYS use Value Objects rather than primitive types.
Installation
This package requires PHP 7.4+
Add it as Composer dependency:
$ composer require mediagone/common-types
List of available Value Objects
All value objects implement a common ValueObject interface and JsonSerializable.
Crypto
Hash(abstract class)HashBcryptHashArgon2id
System
AgeCountCountryDateDateTimeUTCDuration
Text
HexNameSlugTextTextMediumTitle
Web
EmailAddressUrlUrlHostUrlPath
License
Common Types is licensed under MIT license. See LICENSE file.