getwarp/value-object

Value Object library for PHP

Maintainers

👁 tntrex

Package info

github.com/getwarp/value-object

pkg:composer/getwarp/value-object

Fund package maintenance!

getwarp

hustlahusky

Statistics

Installs: 909

Dependents: 3

Suggesters: 1

Stars: 1

3.1.0 2022-08-22 13:41 UTC

Requires (Dev)

Suggests

Provides

None

Conflicts

None

Replaces

None

MIT cf48da9671fd004e328513f334f28cd1144e781b

enumstringuuidintvalue-object

This package is auto-updated.

Last update: 2026-06-22 22:00:02 UTC


README

getwarp/value-object

Value Object library for PHP

GitHubPackagistInstallationUsage

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.