Download the PHP package salamov/dto-hydrator without Composer

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

Latest Stable Version Total Downloads

Description

Dynamic Hydration for DTO's used by Transformers in API Platform .

Install

composer require salamov/dto-hydrator

Usage

While using API Platform , using custom DTO's (defining custom input/output in the @ApiResource) requires you to deal with custom transformers specially when your DTO represents an Entity .

  1. When using an input transformer i.e : after the request body is denormalized into a DTO , you should dehydrate the DTO i.e transform it to an entity in order to be persisted .

  2. When using an output transformer i.e : after the entity is retrieved and waiting to be normalized , you should hydrate the DTO i.e transform the entity into a DTO in order to be displayed .

  3. The embedded objects inside the Dto must be an @ApiResource in order to generate the swagger documentation

  4. If the embedded objects defines id within the denormalized request body it will be referenced and the data will be updated , either it will be persisted as a new Entity.

Example

Above we defined an OrderDto for the Order Entity with two embedded objects Customer and Products one is related to Order by a ManyToOne relations ship and the other is related to Order by a OneToMany relationship.

GET Request

The above request will go first through your custom dataProvider (if you have one) retrieving the Order Entity to be transformed and normalized , if you defined an Ouput for your @ApiResource then you should define a transformer your transformer would look like this :

PUT Request

The above request will be denormalized to your Input class defined in the @ApiResource then to your InputTransformer in order to be transformed to an Entity and persisted , so your InputTransformer would look like this :

N.B : If your body/embedded body contains an id it will be directly referenced to the corresponding entity for that id and the data will be updated , if not it will be created .

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.


All versions of dto-hydrator with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
symfony/property-info Version ^4.0
symfony/serializer Version ^4.0
doctrine/common Version ^2.7
doctrine/orm Version ^2.4
symfony/http-foundation Version ^4.0
symfony/property-access Version ^4.0
symfony/framework-bundle Version 4.2.*
symfony/dependency-injection Version 4.2.*
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 salamov/dto-hydrator contains the following files

Loading the files please wait ....