{"id":13593708,"url":"https://github.com/CuyZ/Valinor","last_synced_at":"2025-04-09T05:31:59.979Z","repository":{"id":37076717,"uuid":"432767611","full_name":"CuyZ/Valinor","owner":"CuyZ","description":"PHP library that helps to map any input into a strongly-typed value object structure.","archived":false,"fork":false,"pushed_at":"2025-03-31T11:07:40.000Z","size":2568,"stargazers_count":1357,"open_issues_count":32,"forks_count":76,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-09T00:11:09.582Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://valinor.cuyz.io","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/CuyZ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["romm"]}},"created_at":"2021-11-28T16:40:17.000Z","updated_at":"2025-04-04T23:07:50.000Z","dependencies_parsed_at":"2024-02-08T20:28:56.056Z","dependency_job_id":"e43f56dc-c4ac-4cce-84e5-9cf7b9acd639","html_url":"https://github.com/CuyZ/Valinor","commit_stats":{"total_commits":437,"total_committers":39,"mean_commits":"11.205128205128204","dds":"0.19450800915331812","last_synced_commit":"2ff1d021bb006d8f8db1b3f1e703ee55bcee2187"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CuyZ%2FValinor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CuyZ%2FValinor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CuyZ%2FValinor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CuyZ%2FValinor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CuyZ","download_url":"https://codeload.github.com/CuyZ/Valinor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247986842,"owners_count":21028889,"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-08-01T16:01:23.432Z","updated_at":"2025-04-09T05:31:59.965Z","avatar_url":"https://github.com/CuyZ.png","language":"PHP","funding_links":["https://github.com/sponsors/romm"],"categories":["PHP","Table of Contents"],"sub_categories":["Filtering, Sanitizing and Validation","Globalization"],"readme":"\u003cdiv align=\"center\"\u003e\n\n![Valinor banner](docs/pages/img/valinor-banner.svg)\n\n\u003cdiv\u003e— From boring old arrays to shiny typed objects —\u003c/div\u003e\n\n\u003cbr\u003e\n\n[![Latest Stable Version](https://poser.pugx.org/cuyz/valinor/v)][link-packagist]\n[![PHP Version Require](https://poser.pugx.org/cuyz/valinor/require/php)][link-packagist]\n[![Total Downloads](https://poser.pugx.org/cuyz/valinor/downloads)][link-packagist]\n[![Mutation testing badge](https://img.shields.io/endpoint?style=flat\u0026url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2FCuyZ%2FValinor%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/CuyZ/Valinor/master)\n\n\u003c/div\u003e\n\n---\n\nValinor takes care of the construction and validation of raw inputs (JSON, plain\narrays, etc.) into objects, ensuring a perfectly valid state. It allows the\nobjects to be used without having to worry about their integrity during the\nwhole application lifecycle.\n\nThe validation system will detect any incorrect value and help the developers by\nproviding precise and human-readable error messages.\n\nThe mapper can handle native PHP types as well as other advanced types supported\nby [PHPStan] and [Psalm] like shaped arrays, generics, integer ranges and more.\n\nThe library also provides a normalization mechanism that can help transform any\ninput into a data format (JSON, CSV, …), while preserving the original \nstructure.\n\n## Installation\n\n```bash\ncomposer require cuyz/valinor\n```\n\n**📔 Read more on the [online documentation](https://valinor.cuyz.io)**\n\n## Example\n\n```php\nfinal class Country\n{\n    public function __construct(\n        /** @var non-empty-string */\n        public readonly string $name,\n        \n        /** @var list\u003cCity\u003e */\n        public readonly array $cities,\n    ) {}\n}\n\nfinal class City\n{\n    public function __construct(\n        /** @var non-empty-string */\n        public readonly string $name,\n        \n        public readonly DateTimeZone $timeZone,\n    ) {}\n}\n\n$json = \u003c\u003c\u003cJSON\n    {\n        \"name\": \"France\",\n        \"cities\": [\n            {\"name\": \"Paris\", \"timeZone\": \"Europe/Paris\"},\n            {\"name\": \"Lyon\", \"timeZone\": \"Europe/Paris\"}\n        ]\n    }\nJSON;\n\ntry {\n    $country = (new \\CuyZ\\Valinor\\MapperBuilder())\n        -\u003emapper()\n        -\u003emap(Country::class, \\CuyZ\\Valinor\\Mapper\\Source\\Source::json($json));\n\n    echo $country-\u003ename; // France \n    echo $country-\u003ecities[0]-\u003ename; // Paris\n} catch (\\CuyZ\\Valinor\\Mapper\\MappingError $error) {\n    // Handle the error…\n}\n```\n\n## Documentation\n\nThe full documentation is available on [valinor.cuyz.io].\n\n## Credits \u0026 thank you\n\nThe development of this library is mainly motivated by the kind words and the\nhelp of many people. I am grateful to everyone, especially to the contributors\nof this repository who directly help to push the project forward:\n\n[![](https://contrib.rocks/image?repo=cuyz/valinor)](https://github.com/cuyz/valinor/graphs/contributors)\n\n### Powered by\n\n[![PhpStorm logo](https://resources.jetbrains.com/storage/products/company/brand/logos/PhpStorm.svg)](https://jb.gg/OpenSourceSupport)\n\nI have to give [JetBrains] credits for providing [a free PhpStorm license] for\nthe development of this open-source package.\n\n### Special thanks\n\nI also want to thank\n[![blackfire-logo] Blackfire](https://www.blackfire.io/?utm_source=valinor\u0026utm_medium=readme\u0026utm_campaign=free-open-source)\nfor providing a license of their awesome tool, leading to notable performance\ngains when using this library.\n\n[link-packagist]: https://packagist.org/packages/cuyz/valinor\n\n[contributors]: https://github.com/CuyZ/Valinor/graphs/contributors\n\n[PHPStan]: https://phpstan.org/\n\n[Psalm]: https://psalm.dev/\n\n[Jetbrains]: https://www.jetbrains.com/\n\n[a free PhpStorm license]: https://jb.gg/OpenSourceSupport\n\n[Blackfire]: https://www.blackfire.io/?utm_source=valinor\u0026utm_medium=readme\u0026utm_campaign=free-open-source\n\n[blackfire-logo]: docs/pages/img/blackfire-logo.svg \"Blackfire logo\"\n\n[valinor.cuyz.io]: https://valinor.cuyz.io\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCuyZ%2FValinor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCuyZ%2FValinor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCuyZ%2FValinor/lists"}