{"id":37232158,"url":"https://github.com/codebooth/data-transfer-object","last_synced_at":"2026-01-15T03:47:40.611Z","repository":{"id":56954926,"uuid":"200508620","full_name":"codebooth/data-transfer-object","owner":"codebooth","description":"Data Transfer Object is all about how the data is represented","archived":false,"fork":false,"pushed_at":"2019-08-10T05:28:45.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-31T17:12:13.615Z","etag":null,"topics":["data-transfer-object","dto","php"],"latest_commit_sha":null,"homepage":null,"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/codebooth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-04T15:20:38.000Z","updated_at":"2019-08-10T05:28:44.000Z","dependencies_parsed_at":"2022-08-21T08:50:26.019Z","dependency_job_id":null,"html_url":"https://github.com/codebooth/data-transfer-object","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codebooth/data-transfer-object","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebooth%2Fdata-transfer-object","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebooth%2Fdata-transfer-object/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebooth%2Fdata-transfer-object/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebooth%2Fdata-transfer-object/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codebooth","download_url":"https://codeload.github.com/codebooth/data-transfer-object/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebooth%2Fdata-transfer-object/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28418017,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["data-transfer-object","dto","php"],"created_at":"2026-01-15T03:47:39.917Z","updated_at":"2026-01-15T03:47:40.602Z","avatar_url":"https://github.com/codebooth.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Data Transfer Object\n\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![Build Status](https://img.shields.io/travis/codebooth/data-transfer-object/master.svg?style=flat-square)](https://travis-ci.org/codebooth/data-transfer-object)\n[![SensioLabsInsight](https://img.shields.io/scrutinizer/quality/g/codebooth/data-transfer-object.svg?style=flat-square)](https://scrutinizer-ci.com/g/codebooth/data-transfer-object)\n[![CodeClimate](https://img.shields.io/codeclimate/maintainability/codebooth/data-transfer-object.svg?style=flat-square)](https://codeclimate.com/github/codebooth/data-transfer-object)\n\nA Data Transfer Object (DTO) is an object used to pass data between different \nlayers in your application. It holds no business data, but only the minimum \nrequired data to transfer between layers or applications. \n\nThe DTOs can help to put your unstructured arrays into a clean structure:\n  - You clearly see what fields are available, and what type that field is \n  (using IDE you get fully type-hinting/autocomplete to be super quick here).\n  - You get a clear exception/error on fields that are either unexpected or \n  missing where you want this kind of information – early on instead of \n  somewhere down the line.\n\n## Getting Started\n\nYou can install the package via composer:\n\n```bash\ncomposer require codebooth/data-transfer-object\n```\n\n## Example\n\nLet's consider the following scenario - you recieve following data from \na HTTP POST request:\n\n```php\n$input = [\n    'url' =\u003e 'https://github.com',\n    'number' =\u003e 1234,\n    'state' =\u003e 'open',\n    'title' =\u003e 'new-feature',\n];\n```\n\nA data transfer object of the above entity would look something as shown below: \n\n```php\nuse CodeBooth\\DataTransferObject\\DataTransferObject;\n\nclass ExampleObject extends DataTransferObject\n{\n    public $url;\n    \n    public $number;\n    \n    public $state;\n    \n    public $title;\n}\n```  \n\nNow the data transfer object could be constructed like this:\n\n```php\n$object = new ExampleObject($input)\n\necho $object-\u003eurl; // outputs 'https://github.com'\necho $object-\u003enumber; // outputs 1234\necho $object-\u003estate; // outputs 'open'\n``` \n\n\n## License\n\nCopyright (c) 2019 CodeBooth. Released under the [MIT License](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodebooth%2Fdata-transfer-object","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodebooth%2Fdata-transfer-object","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodebooth%2Fdata-transfer-object/lists"}