gentle/embeddables

Small collection of value objects.

0.2.0 2021-04-05 07:18 UTC

This package is auto-updated.

Last update: 2024-04-05 15:30:15 UTC


README

Latest Version License Build Status Coverage Status Code quality

Small collection of Value Objects to ease composition.

Install

Via Composer

$ composer require gentle/embeddables

Usage

use Gentle\Embeddable\Date;
use Gentle\Embeddable\Time;

$date = new Date(
    new Date\Year(2016),
    new Date\Month(12),
    new Date\Day(25)
);
echo (string)$date; // 2016-12-25

$time = new Time(
    new Time\Hour(23),
    new Time\Minute('04'),
    new Time\Second(14)
);

// changing timezone will return a new `Time` object
$time = $time->withTimeZone(new \DateTimeZone('Europe/Monaco'));
echo (string)$time; // 23:04:14

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details.

Security

For any security related issues, please send an email at alex@gentle.ro instead of using the issue tracker.

License

Licensed under the MIT License - see the LICENSE file for details.