{"id":18285500,"url":"https://github.com/bemit/orbiter-hydrator","last_synced_at":"2025-04-09T06:16:51.330Z","repository":{"id":57032764,"uuid":"420703563","full_name":"bemit/orbiter-hydrator","owner":"bemit","description":"PHP Object Hydrator","archived":false,"fork":false,"pushed_at":"2022-10-20T18:41:50.000Z","size":45,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-15T00:32:58.244Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bemit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-24T14:13:21.000Z","updated_at":"2021-10-24T22:41:25.000Z","dependencies_parsed_at":"2022-08-23T18:50:39.773Z","dependency_job_id":null,"html_url":"https://github.com/bemit/orbiter-hydrator","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bemit%2Forbiter-hydrator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bemit%2Forbiter-hydrator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bemit%2Forbiter-hydrator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bemit%2Forbiter-hydrator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bemit","download_url":"https://codeload.github.com/bemit/orbiter-hydrator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247987285,"owners_count":21028895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T13:16:52.723Z","updated_at":"2025-04-09T06:16:51.290Z","avatar_url":"https://github.com/bemit.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Orbiter\\Hydrator\n\n[![Latest Stable Version](https://poser.pugx.org/orbiter/hydrator/version.svg)](https://packagist.org/packages/orbiter/hydrator)\n[![Latest Unstable Version](https://poser.pugx.org/orbiter/hydrator/v/unstable.svg)](https://packagist.org/packages/orbiter/hydrator)\n[![codecov](https://codecov.io/gh/bemit/orbiter-hydrator/branch/master/graph/badge.svg?token=1bWW7plF1C)](https://codecov.io/gh/bemit/orbiter-hydrator)\n[![Total Downloads](https://poser.pugx.org/orbiter/hydrator/downloads.svg)](https://packagist.org/packages/orbiter/hydrator)\n[![Github actions Build](https://github.com/bemit/orbiter-hydrator/actions/workflows/blank.yml/badge.svg)](https://github.com/bemit/orbiter-hydrator/actions)\n[![PHP Version Require](http://poser.pugx.org/orbiter/hydrator/require/php)](https://packagist.org/packages/orbiter/hydrator)\n\nHydrator to create PHP objects from data, using Reflections, use e.g. PSR Container through a [FactoryInterface](https://github.com/bemit/orbiter-hydrator/blob/master/src/FactoryInterface.php).\n\n```shell\ncomposer require orbiter/hydrator\n```\n\n```injectablephp\n// needs implementation:\n// $factory = \\Orbiter\\Hydrator\\FactoryInterface()\n$hydrator = new \\Orbiter\\Hydrator\\Hydrator($factory);\n\n// params = e.g. most likely used by your factory for __construct, array of params\n$hydrator-\u003emake($class_name, $params);\n\n// data = use to hydrate after instance creation, can be associative array or stdClass\n//        uses keys/properties as names for the property to inject\n// third parameter = true ignores missing properties\n$hydrator-\u003ehydrate($class, $data, false);\n$hydrator-\u003emakeAndInject($class_name, $data, false, $params);\n\n//\n// for PHP-DI users:\nuse function DI\\autowire;\nuse function DI\\get;\n\n$dependencies = [\n    Orbiter\\Hydrator\\BridgePHPDIFactory::class =\u003e autowire()\n        -\u003econstructorParameter('factory', get(DI\\FactoryInterface::class)),\n    Orbiter\\Hydrator\\Hydrator::class =\u003e autowire()\n        -\u003econstructorParameter('factory', get(Orbiter\\Hydrator\\BridgePHPDIFactory::class)),\n]\n```\n\n## Dev Notices\n\nCommands to set up and run e.g. tests:\n\n```bash\n# on windows:\ndocker run -it --rm -v %cd%:/app composer install\n\ndocker run -it --rm -v %cd%:/var/www/html php:8.1-cli-alpine sh\n\ndocker run --rm -v %cd%:/var/www/html php:8.1-cli-alpine sh -c \"cd /var/www/html \u0026\u0026 ./vendor/bin/phpunit --testdox -c phpunit-ci.xml --bootstrap vendor/autoload.php\"\n\n# on unix:\ndocker run -it --rm -v `pwd`:/app composer install\n\ndocker run -it --rm -v `pwd`:/var/www/html php:8.1-cli-alpine sh\n\ndocker run --rm -v `pwd`:/var/www/html php:8.1-cli-alpine sh -c \"cd /var/www/html \u0026\u0026 ./vendor/bin/phpunit --testdox -c phpunit-ci.xml --bootstrap vendor/autoload.php\"\n```\n\n## Versions\n\nThis project adheres to [semver](https://semver.org/), **until `1.0.0`** and beginning with `0.1.0`: all `0.x.0` releases are like MAJOR releases and all `0.0.x` like MINOR or PATCH, modules below `0.1.0` should be considered experimental.\n\n## License\n\nThis project is free software distributed under the [**MIT LICENSE**](LICENSE).\n\n### Contributors\n\nBy committing your code to the code repository you agree to release the code under the MIT License attached to the repository.\n\n***\n\nMaintained by [Michael Becker](https://mlbr.xyz)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbemit%2Forbiter-hydrator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbemit%2Forbiter-hydrator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbemit%2Forbiter-hydrator/lists"}