{"id":13593577,"url":"https://github.com/spatie/laravel-data","last_synced_at":"2025-05-11T14:02:57.269Z","repository":{"id":37422015,"uuid":"367364180","full_name":"spatie/laravel-data","owner":"spatie","description":"Powerful data objects for Laravel","archived":false,"fork":false,"pushed_at":"2025-04-30T11:27:23.000Z","size":3043,"stargazers_count":1443,"open_issues_count":13,"forks_count":235,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-05-11T14:01:45.833Z","etag":null,"topics":["laravel","php"],"latest_commit_sha":null,"homepage":"https://spatie.be/docs/laravel-data/","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/spatie.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"docs/support-us.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"spatie"}},"created_at":"2021-05-14T13:02:12.000Z","updated_at":"2025-05-10T18:51:16.000Z","dependencies_parsed_at":"2023-02-13T19:15:30.821Z","dependency_job_id":"3c2a09dd-7d62-4c56-8175-ea56961f0d3a","html_url":"https://github.com/spatie/laravel-data","commit_stats":{"total_commits":958,"total_committers":79,"mean_commits":"12.126582278481013","dds":0.7432150313152401,"last_synced_commit":"90e42a763afbb0ced28577502122ac40ad4b917b"},"previous_names":[],"tags_count":121,"template":false,"template_full_name":"spatie/package-skeleton-laravel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flaravel-data","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flaravel-data/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flaravel-data/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flaravel-data/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spatie","download_url":"https://codeload.github.com/spatie/laravel-data/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253576264,"owners_count":21930169,"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":["laravel","php"],"created_at":"2024-08-01T16:01:21.743Z","updated_at":"2025-05-11T14:02:57.128Z","avatar_url":"https://github.com/spatie.png","language":"PHP","funding_links":["https://github.com/sponsors/spatie"],"categories":["Laravel \u0026 Framework Integrations","PHP","Resources"],"sub_categories":["Data \u0026 DTO tools","Server-side"],"readme":"\u003cdiv align=\"left\"\u003e\n    \u003ca href=\"https://spatie.be/open-source?utm_source=github\u0026utm_medium=banner\u0026utm_campaign=laravel-data\"\u003e\n      \u003cpicture\u003e\n        \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://spatie.be/packages/header/laravel-data/html/dark.webp\"\u003e\n        \u003cimg alt=\"Logo for laravel-data\" src=\"https://spatie.be/packages/header/laravel-data/html/light.webp\" height=\"190\"\u003e\n      \u003c/picture\u003e\n    \u003c/a\u003e\n\n\u003ch1\u003ePowerful data objects for Laravel\u003c/h1\u003e\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/laravel-data.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-data)\n[![Tests](https://github.com/spatie/laravel-data/actions/workflows/run-tests.yml/badge.svg)](https://github.com/spatie/laravel-data/actions/workflows/run-tests.yml)\n[![PHPStan](https://github.com/spatie/laravel-data/actions/workflows/phpstan.yml/badge.svg)](https://github.com/spatie/laravel-data/actions/workflows/phpstan.yml)\n[![Check \u0026 fix styling](https://github.com/spatie/laravel-data/actions/workflows/php-cs-fixer.yml/badge.svg)](https://github.com/spatie/laravel-data/actions/workflows/php-cs-fixer.yml)\n[![Total Downloads](https://img.shields.io/packagist/dt/spatie/laravel-data.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-data)\n    \n\u003c/div\u003e\n\nThis package enables the creation of rich data objects which can be used in various ways. Using this package you only need to describe your data once:\n\n- instead of a form request, you can use a data object\n- instead of an API transformer, you can use a data object\n- instead of manually writing a typescript definition, you can use... 🥁 a data object\n\nA `laravel-data` specific object is just a regular PHP object that extends from `Data`:\n\n```php\nuse Spatie\\LaravelData\\Data;\n\nclass SongData extends Data\n{\n    public function __construct(\n        public string $title,\n        public string $artist,\n    ) {\n    }\n}\n```\n\nBy extending from `Data` you enable a lot of new functionality like:\n\n- Automatically transforming data objects into resources (like the Laravel API resources)\n- Transform only the requested parts of data objects with lazy properties\n- Automatically creating data objects from request data and validating them\n- Automatically resolve validation rules for properties within a data object\n- Make it possible to construct a data object from any type you want\n- Add support for automatically validating data objects when creating them\n- Generate TypeScript definitions from your data objects you can use on the frontend\n- Save data objects as properties of an Eloquent model\n- And a lot more ...\n\nWhy would you be using this package?\n\n- You can be sure that data is typed when it leaves your app and comes back again from the frontend which makes a lot less errors\n- You don't have to write the same properties three times (in a resource, in a data transfer object and in request validation)\n- You need to write a lot less of validation rules because they are obvious through PHP's type system\n- You get TypeScript versions of the data objects for free\n\n## Are you a visual learner?\n\nIn this talk, given at Laracon, you'll see [an introduction to Laravel Data](https://www.youtube.com/watch?v=CrO_7Df1cBc).\n\n## Support us\n\n[\u003cimg src=\"https://github-ads.s3.eu-central-1.amazonaws.com/laravel-data.jpg?t=1\" width=\"419px\" /\u003e](https://spatie.be/github-ad-click/laravel-data)\n\nWe invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).\n\nWe highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).\n\n## Documentation\n\nYou will find full documentation on the dedicated [documentation](https://spatie.be/docs/laravel-data/v4/introduction) site.\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [Ruben Van Assche](https://github.com/rubenvanassche)\n- [Aidan Casey](https://github.com/aidan-casey) (Validation Attributes)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatie%2Flaravel-data","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspatie%2Flaravel-data","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatie%2Flaravel-data/lists"}