Download the PHP package hyperized/value-objects without Composer

On this page you can find all versions of the php package hyperized/value-objects. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package value-objects

Value Objects

FOSSA Status

A typed, immutable value objects collection for PHP 8.4+.

All value objects validate on construction, are immutable (readonly classes), and follow the same pattern: extend an abstract, get validation for free.

Install

Quick start

Use the provided concrete classes directly:

Or extend an abstract to create your own domain-specific value object:

Available value objects

Integers

Class Description
Integer Any integer value
PositiveInteger Must be > 0
NegativeInteger Must be < 0
NonNegativeInteger Must be >= 0
RangedInteger Within a min/max range (defaults to PHP_INT_MIN/PHP_INT_MAX)
Octal Valid octal number with decimal conversion
Hexadecimal Hex string parsing with asHexString()
Port Network port (1-65535)

Real numbers

Class Description
RealNumber Any float value
Percentage Float between 0-100, with asFraction()

Spatial

Class Description
Coordinate Latitude (-90/90) and longitude (-180/180) pair
BoundingBox Southwest/northeast coordinate pair with contains()
Distance Non-negative distance with unit conversions (m/km/mi/ft/nm)
Bearing Compass heading (0-360) with getCardinal()
Altitude Height above/below sea level with unit conversions (m/ft)
GeoHash Base-32 encoded location string with getPrecision()
Polygon Ordered list of coordinates (minimum 3 points)
LineString Ordered list of coordinates (minimum 2 points)

Strings

Class Description
ByteArray Any string value
EmptyByteArray Must be empty
NonEmptyByteArray Must be non-empty
Email Validated email with getLocalPart() / getDomain()
Url Validated URL with getScheme() / getHost() / getPath()
Uri URI with scheme requirement, getQuery() / getFragment()
Uuid RFC 4122 UUID, normalizes to lowercase, getVersion()
IpAddress IPv4/IPv6 with isIPv4() / isIPv6()
Hostname RFC-compliant, max 253 chars, normalized to lowercase
MacAddress Colon or dash format, normalized to lowercase colon-separated
Json Validated JSON string with decode()
Regex Validated regex pattern with matches()
SemVer Semantic version with getMajor() / getMinor() / getPatch()
DateString ISO 8601 / Y-m-d date with toDateTimeImmutable()

Lists

Class Description
Inventory From comma-separated string, with contains()
ConstrainedList List with a set of allowed values

Extending

Every concrete class extends an abstract that you can extend for your own domain types. Override validate() to add custom rules:

See the examples/ directory for more usage patterns.

Quality

Licence

MIT

FOSSA Status

Author

Gerben Geijteman [email protected]


All versions of value-objects with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hyperized/value-objects contains the following files

Loading the files please wait ...