{"id":28892865,"url":"https://github.com/wundii/data-mapper-symfony-bundle","last_synced_at":"2026-03-17T08:32:04.567Z","repository":{"id":297921094,"uuid":"998272361","full_name":"wundii/data-mapper-symfony-bundle","owner":"wundii","description":"A Symfony bundle providing seamless integration for the wundii/data-mapper","archived":false,"fork":false,"pushed_at":"2025-06-18T08:19:48.000Z","size":39,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-18T08:35:33.142Z","etag":null,"topics":["deserialisation","hydrations","json","mapper","neon","object","php","symfony","symfony-bundle","xml","yaml"],"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/wundii.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2025-06-08T08:46:45.000Z","updated_at":"2025-06-18T08:12:24.000Z","dependencies_parsed_at":"2025-06-08T11:32:05.099Z","dependency_job_id":null,"html_url":"https://github.com/wundii/data-mapper-symfony-bundle","commit_stats":null,"previous_names":["wundii/data-mapper-symfony-bundle"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/wundii/data-mapper-symfony-bundle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wundii%2Fdata-mapper-symfony-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wundii%2Fdata-mapper-symfony-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wundii%2Fdata-mapper-symfony-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wundii%2Fdata-mapper-symfony-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wundii","download_url":"https://codeload.github.com/wundii/data-mapper-symfony-bundle/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wundii%2Fdata-mapper-symfony-bundle/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261050697,"owners_count":23102556,"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":["deserialisation","hydrations","json","mapper","neon","object","php","symfony","symfony-bundle","xml","yaml"],"created_at":"2025-06-21T02:06:53.769Z","updated_at":"2026-03-17T08:32:04.562Z","avatar_url":"https://github.com/wundii.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp style=\"text-align:center\"\u003e\n  \u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/wundii/data-mapper/refs/heads/main/assets/data-mapper-dark.png\"\u003e\n    \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/wundii/data-mapper/refs/heads/main/assets/data-mapper-light.png\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/wundii/data-mapper/refs/heads/main/assets/data-mapper-light.png\" alt=\"wundii/data-mapper-symfony-bundle\" style=\"width: 100%; max-width: 600px; height: auto;\"\u003e\n  \u003c/picture\u003e\n\u003c/p\u003e\n\n[![PHP-Tests](https://img.shields.io/github/actions/workflow/status/wundii/data-mapper-symfony-bundle/code_quality.yml?branch=main\u0026style=for-the-badge)](https://github.com/wundii/data-mapper-symfony-bundle/actions/workflows/code_quality.yml)\n[![PHPStan](https://img.shields.io/badge/PHPStan-level%2010-brightgreen.svg?style=for-the-badge)](https://phpstan.org/)\n![VERSION](https://img.shields.io/packagist/v/wundii/data-mapper-symfony-bundle?style=for-the-badge)\n[![PHP](https://img.shields.io/packagist/php-v/wundii/data-mapper-symfony-bundle?style=for-the-badge)](https://www.php.net/)\n[![Rector](https://img.shields.io/badge/Rector-8.2-blue.svg?style=for-the-badge)](https://getrector.com)\n[![ECS](https://img.shields.io/badge/ECS-check-blue.svg?style=for-the-badge)](https://tomasvotruba.com/blog/zen-config-in-ecs)\n[![PHPUnit](https://img.shields.io/badge/PHP--Unit-check-blue.svg?style=for-the-badge)](https://phpunit.org)\n[![codecov](https://img.shields.io/codecov/c/github/wundii/data-mapper-symfony-bundle/main?token=V61OLHU8X3\u0026style=for-the-badge)](https://codecov.io/github/wundii/data-mapper-symfony-bundle)\n[![Downloads](https://img.shields.io/packagist/dt/wundii/data-mapper-symfony-bundle.svg?style=for-the-badge)](https://packagist.org/packages/wundii/data-mapper-symfony-bundle)\n\nA Symfony integration for [wundii/data-mapper](https://github.com/wundii/data-mapper).\nThis library is an extremely fast and strictly typed object mapper built for modern PHP (8.2+).\nIt seamlessly transforms data from formats like CSV, JSON, NEON, XML, YAML, array, and standard objects into well-structured PHP objects.\n\nIdeal for developers who need reliable and efficient data mapping without sacrificing code quality or modern best practices.\n\n## Features\n- Mapping source data into objects\n- Mapping source data with a list of elements into a list of objects\n- Initialize object via constructor, properties or methods\n- Map nested objects, arrays of objects\n- Class mapping for interfaces or other classes\n- Custom root element for starting with the source data\n- Auto-casting for `float` types (eu to us decimal separator)\n- Target alias via Attribute for properties and methods\n- Automatic data sorting for constructor parameters\n\n## Supported Types\n- `null`\n- `bool`|`?bool`\n- `int`|`?int`\n- `float`|`?float`\n- `string`|`?string`\n- `array`\n  - `int[]`\n  - `float[]`\n  - `string[]`\n  - `object[]`\n- `object`|`?object`\n- `enum`|`?enum`\n\n## Supported Formats\noptional formats are marked with an asterisk `*`\n- `array`\n- `csv`\n- `json`\n- `neon`*\n- `object`\n  - `public property`\n  - `public getters`\n  - `method toArray()`\n  - `attribute SourceData('...')`\n- `xml`\n- `yaml`*\n\n## Installation\nRequire the bundle and its dependencies with composer:\n\n```bash\ncomposer require wundii/data-mapper-symfony-bundle\n```\n\nInclude the bundle in your `bundles.php`:\n\n```php\nreturn [\n    // ...\n    Wundii\\DataMapper\\SymfonyBundle\\DataMapperBundle::class =\u003e ['all' =\u003e true],\n];\n```\n\nCreate a Symfony configuration file `config/packages/data_mapper.yaml` with the command:\n\n```bash\nbin/console data-mapper:default-config\n```\n\n## Configuration File\nThe following setting options are available\n\n```yaml\ndata_mapper:\n    data_config:\n        approach: 'CONSTRUCTOR|PROPERTY|SETTER' # ApproachEnum::SETTER\n        accessible: 'PRIVATE|PUBLIC' # AccessibleEnum::PUBLIC\n        class_map:\n          InterfaceOrClassName: 'ClassName', # Class mapping for interfaces or other classes\n          ...: ...\n```\n\n## Use as Symfony DataMapper version\n```php\n\u003c?php\n\ndeclare(strict_types=1);\n\nnamespace App\\Controller;\n\nuse App\\Dto\\TestClass;\nuse Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\Routing\\Attribute\\Route;\nuse Wundii\\DataMapper\\SymfonyBundle\\DataMapper;\n\nfinal class YourController extends AbstractController\n{\n    public function __construct(\n        private readonly DataMapper $dataMapper,\n    ) {\n    }\n\n    #[Route('/do-something/', name: 'app_do-something')]\n    public function doSomething(Request $request): Response\n    {\n        // Automatic recognition of the format based on the content type of the request\n        // returns an instance of TestClass or an Exception\n        $testClass = $this-\u003edataMapper-\u003erequest($request, TestClass::class);\n\n        // or you can use tryRequest to avoid exceptions, null will be returned instead\n        $testClass = $this-\u003edataMapper-\u003etryRequest($request, TestClass::class);\n        $this-\u003edataMapper-\u003egetMapStatusEnum();\n        $this-\u003edataMapper-\u003egetErrorMessage();\n\n        // Do something with $testClass\n\n        return $this-\u003ejson(...);\n    }\n}\n```\n\n## Use as native DataMapper version\n```php\n\u003c?php\n\ndeclare(strict_types=1);\n\nnamespace App\\Controller;\n\nuse App\\Dto\\TestClass;\nuse Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\Routing\\Attribute\\Route;\nuse Wundii\\DataMapper\\DataMapper;\n\nfinal class YourController extends AbstractController\n{\n    public function __construct(\n        private readonly DataMapper $dataMapper,\n    ) {\n    }\n\n    #[Route('/do-something/', name: 'app_do-something')]\n    public function doSomething(Request $request): Response\n    {\n        // you can use the native DataMapper methods directly\n        $testClass = $this-\u003edataMapper-\u003ejson($request-\u003egetContent(), TestClass::class);\n\n        // Do something with $testClass\n\n        return $this-\u003ejson(...);\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwundii%2Fdata-mapper-symfony-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwundii%2Fdata-mapper-symfony-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwundii%2Fdata-mapper-symfony-bundle/lists"}