An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# Value Objects
[![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)

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

[![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)

## Author

Gerben Geijteman