getwarp / value-object
Value Object library for PHP
Fund package maintenance!
getwarp
hustlahusky
Requires
- php: ^7.4|^8.0
- ext-json: *
- getwarp/common: ^3.1
- getwarp/exception: ^3.1
- php-http/discovery: ^1.11
- psr/http-message: ^1.0
- symfony/polyfill-php80: ^1.22
- symfony/polyfill-php81: ^1.22
- symfony/string: ^5.2|^6.0
Requires (Dev)
- nyholm/psr7: ^1.4
- phpunit/phpunit: ^9.5
- symfony/uid: ^5.2|^6.0
Suggests
- psr/http-factory: To use UriValue
- symfony/uid: To use UuidValue
README
getwarp/value-object
Value Object library for PHP
GitHub • Packagist • Installation • Usage
Installation
Via Composer
$ composer require getwarp/value-object
Usage
use Warp\ValueObject\AbstractIntValue; use Warp\ValueObject\AbstractEnumValue; class PostId extends AbstractIntValue { } $postId = PostId::new(10); \assert($int->value() === 10); \assert(PostId::new(10) === $postId); /** * @method static self public() * @method static self draft() */ class PostStatus extends AbstractEnumValue { public const PUBLIC = 'public'; public const DRAFT = 'draft'; } $draftStatus = PostStatus::draft(); $publicStatus = PostStatus::public(); \assert($draftStatus !== $publicStatus);
Change log
Please see CHANGELOG for more information on what has changed recently.
Contributing
Report issues and send pull requests in the main Warp repository. Please see contributing guide and code of conduct for details.
Credits
License
The MIT License (MIT). Please see license file for more information.