https://github.com/hyperized/value-objects
A basic PHP value objects collection
https://github.com/hyperized/value-objects
Last synced: 11 months ago
JSON representation
A basic PHP value objects collection
- Host: GitHub
- URL: https://github.com/hyperized/value-objects
- Owner: hyperized
- Created: 2020-02-11T10:00:30.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-23T20:03:14.000Z (about 3 years ago)
- Last Synced: 2025-03-18T18:21:26.673Z (11 months ago)
- Language: PHP
- Size: 177 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Value Objects
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fhyperized%2Fvalue-objects?ref=badge_shield)
A basic PHP value objects collection.
## Install
```bash
composer require hyperized/value-objects
```
## Examples
### Integer type
```php
getValue()); // int(1337)
```
Other types that are offered:
* NegativeInteger.
* Validates value is below 0 (zero).
* PositiveInteger
* Validates value is above 0 (zero).
* RangedInteger.
* Validates value is higher than minimum.
* Validates value is lower than maximum.
* By default minimum value is `PHP_INT_MIN` and maximum value `PHP_INT_MAX`.
* Octal.
* Validates value is octal.
### String type (ByteArray)
Strings are called ByteArrays due to string being a reserved word in PHP.
```php
getValue()); // string('Hello world');
```
Other types that are offered:
* EmptyByteArray.
* Validates value equals '' (empty string)
* NonEmptyByteArray.
* Validates value does not equal '' (empty string)
## Licence
MIT
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fhyperized%2Fvalue-objects?ref=badge_large)
## Author
Gerben Geijteman