{"id":16409801,"url":"https://github.com/hyperized/value-objects","last_synced_at":"2025-03-23T06:31:02.130Z","repository":{"id":56024730,"uuid":"239729506","full_name":"hyperized/value-objects","owner":"hyperized","description":"A basic PHP value objects collection","archived":false,"fork":false,"pushed_at":"2022-12-23T20:03:14.000Z","size":181,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T18:21:26.673Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hyperized.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-11T10:00:30.000Z","updated_at":"2023-07-25T14:32:49.000Z","dependencies_parsed_at":"2023-01-30T19:30:41.532Z","dependency_job_id":null,"html_url":"https://github.com/hyperized/value-objects","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperized%2Fvalue-objects","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperized%2Fvalue-objects/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperized%2Fvalue-objects/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperized%2Fvalue-objects/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyperized","download_url":"https://codeload.github.com/hyperized/value-objects/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245066496,"owners_count":20555402,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T06:21:32.679Z","updated_at":"2025-03-23T06:31:01.761Z","avatar_url":"https://github.com/hyperized.png","language":"PHP","readme":"# Value Objects\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fhyperized%2Fvalue-objects.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fhyperized%2Fvalue-objects?ref=badge_shield)\n\n\nA basic PHP value objects collection.\n\n## Install\n\n```bash\ncomposer require hyperized/value-objects\n```\n\n## Examples\n\n### Integer type\n\n```php\n\u003c?php declare(strict_types=1);\n\nuse Hyperized\\ValueObjects\\Abstracts\\Integers\\AbstractInteger;\n\ninclude 'vendor/autoload.php';\n\n// Implement concrete class for as value object\nclass MyObject extends AbstractInteger {}\n\n$myObject = MyObject::fromInteger(1337);\n\nvar_dump($myObject-\u003egetValue()); // int(1337)\n```\n\nOther types that are offered:\n\n* NegativeInteger.\n\t* Validates value is below 0 (zero).\n* PositiveInteger\n\t* Validates value is above 0 (zero).\n* RangedInteger.\n\t* Validates value is higher than minimum.\n\t* Validates value is lower than maximum.\n\t* By default minimum value is `PHP_INT_MIN` and maximum value `PHP_INT_MAX`.\n* Octal.\n\t* Validates value is octal.\n\n### String type (ByteArray)\n\nStrings are called ByteArrays due to string being a reserved word in PHP.\n\n```php\n\u003c?php declare(strict_types=1);\n\nuse Hyperized\\ValueObjects\\Abstracts\\Strings\\AbstractByteArray;\n\ninclude 'vendor/autoload.php';\n\nclass MyObject extends AbstractByteArray {}\n\n$myObject = MyObject::fromString('Hello world!');\nvar_dump($myObject-\u003egetValue()); // string('Hello world');\n```\n\nOther types that are offered:\n\n* EmptyByteArray.\n    * Validates value equals '' (empty string)\n* NonEmptyByteArray.\n    * Validates value does not equal '' (empty string)\n\n## Licence\n\nMIT\n\n\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fhyperized%2Fvalue-objects.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fhyperized%2Fvalue-objects?ref=badge_large)\n\n## Author\n\nGerben Geijteman \u003cgerben@hyperized.net\u003e","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperized%2Fvalue-objects","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyperized%2Fvalue-objects","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperized%2Fvalue-objects/lists"}