Download the PHP package atto/hydrator without Composer

On this page you can find all versions of the php package atto/hydrator. 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 hydrator

Atto Hydrator

The hydrator is designed to quickly serialise (extract) and deserialise (hydrate) complex objects.

It works out of the box on simple data structures. For anything else, behaviour can be defined to meet your needs.

Default Behaviour

Your DTO's properties are extracted into an array.

The value of each property is converted into a JSON string.

Arrays must specify a subtype. Arrays ordered integer keys (lists) are extracted into a nested JSON array. Arrays with specified keys are extracted into a nested JSON object.

Object are extracted into a nested JSON object.

If the default behaviour does not suit your needs; you can manually define alternate behaviour

Manually Defined Behaviour

Behaviour can be defined using attributes from the Atto\Hydrator\Attribute namespace.

Serialization Strategy

Serialization strategies are only useful for arrays of data. They will have no impact on scalars. They cannot be used on objects.

The default strategy is to serialize as JSON.

It may also be serialized to a comma-delimited or pipe-delimited list.

CommaDelimited and PipeDelimited serialisation will:

Hydration Strategy

Json

Json will json encode your property before the entire object is json encoded.

The hydrator will extract the following output:

Merge

Merge can only be used for a single level.

If you specify Merge on an object contains a nested object property. The nested object's properties are merged into the original object, as if it were its own properties.

The hydrator will extract the following output:

If your property names include underscores, undefined behaviour MAY occur. Stick to camelCase property names for predictable behaviour.

Nest

Nest is the default behaviour of any property except DateTimes, Enums and Scalars.

You should never need to specify it explicitly.

The hydrator will extract the following output:

Passthrough

Passthrough will leave your property pass through untouched.

If Passthrough is used, it should be used at every level above it as well.

StringWrapper

A StringWrapper is an object which; takes a single string argument to __construct and returns it with __toString().

i.e.

For objects like this, we can serialise them as their constructor argument, a simple string.

DateTime, Enum & Scalar

Datetimes, Enums and Scalars have their own default strategies.

They do not need to be specified, but they can be overriden if you choose.

Subtype

For an array, a subtype must be specified.

Arrays must only contain items of that subtype.

This is because, serialised data does not contain information of its type. The hydrator uses this Subtype attribute to determine what to hydrate each item as.


All versions of hydrator with dependencies

PHP Build Version
Package Version
Requires php Version ~8.2.0 || ~8.3.0
doctrine/instantiator Version ^2.0
atto/codegen-tools Version ^0.1.0
roave/better-reflection Version ^6.25
symfony/console Version ^6.4 || ^7.0
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 atto/hydrator contains the following files

Loading the files please wait ....