Download the PHP package nutgram/hydrator without Composer
On this page you can find all versions of the php package nutgram/hydrator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nutgram/hydrator
More information about nutgram/hydrator
Files in nutgram/hydrator
Package hydrator
Short Description Hydrator for PHP 8.0+
License MIT
Homepage https://github.com/nutgram/hydrator
Informations about the package hydrator
Strongly typed hydrator for PHP 8.0+
Fork of the original project https://github.com/sunrise-php/hydrator.
Installation
How to use?
Allowed property types
Required
If a property has no a default value, then the property is required.
Optional
If a property has a default value, then the property is optional.
Null
If a property is nullable, then the property can accept null.
If the property should be optional, then it must has a default value.
Boolean
Accepts the following values: true, false, 1, 0, "1", "0", "yes", "no", "on" and "no".
Integer
Accepts only integers (also as a string).
Number<int|float>
Accepts only numbers (also as a string).
String
Accepts only strings.
Array<array-key, mixed>
Accepts only arrays.
Array<array-key, class>
Accept a list of objects.
Object
Accepts only objects.
DateTime/DateTimeImmutable
Integers (also as a string) will be handled as a timestamp, otherwise accepts only valid date-time strings.
DateInterval
Accepts only valid date-interval strings based on ISO 8601.
Enum
Accepts only values that exist in an enum.
Association
Accepts a valid structure for an association
Property alias
If you need to get a non-normalized key, use aliases.
For example, the Google Recaptcha API returns the following response:
To correctly map the response, use the following model: