{"id":36990642,"url":"https://github.com/php-collective/laravel-dto","last_synced_at":"2026-01-13T23:38:41.829Z","repository":{"id":328812583,"uuid":"1116853247","full_name":"php-collective/laravel-dto","owner":"php-collective","description":null,"archived":false,"fork":false,"pushed_at":"2025-12-16T22:29:08.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-18T16:39:18.291Z","etag":null,"topics":[],"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/php-collective.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-15T13:26:52.000Z","updated_at":"2025-12-16T22:28:55.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/php-collective/laravel-dto","commit_stats":null,"previous_names":["php-collective/laravel-dto"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/php-collective/laravel-dto","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-collective%2Flaravel-dto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-collective%2Flaravel-dto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-collective%2Flaravel-dto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-collective%2Flaravel-dto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php-collective","download_url":"https://codeload.github.com/php-collective/laravel-dto/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-collective%2Flaravel-dto/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28399508,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: 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":[],"created_at":"2026-01-13T23:38:41.133Z","updated_at":"2026-01-13T23:38:41.821Z","avatar_url":"https://github.com/php-collective.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel DTO\n\nLaravel integration for [php-collective/dto](https://github.com/php-collective/dto).\n\n## Installation\n\n```bash\ncomposer require php-collective/laravel-dto\n```\n\nThe service provider will be auto-discovered.\n\n## Configuration\n\nPublish the config file:\n\n```bash\nphp artisan vendor:publish --provider=\"PhpCollective\\LaravelDto\\DtoServiceProvider\"\n```\n\nThis creates `config/dto.php` with the following options:\n\n```php\nreturn [\n    'config_path' =\u003e config_path(),     // Where DTO config files are located\n    'output_path' =\u003e app_path('Dto'),   // Where to generate DTOs\n    'namespace' =\u003e 'App\\\\Dto',          // Namespace for generated DTOs\n];\n```\n\n## Usage\n\n### 1. Create your DTO configuration\n\nCreate `config/dto.xml` (or `config/dtos.xml` to avoid conflicts):\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cdtos xmlns=\"php-collective-dto\"\u003e\n    \u003cdto name=\"User\"\u003e\n        \u003cfield name=\"id\" type=\"int\"/\u003e\n        \u003cfield name=\"name\" type=\"string\"/\u003e\n        \u003cfield name=\"email\" type=\"string\"/\u003e\n    \u003c/dto\u003e\n\u003c/dtos\u003e\n```\n\n### 2. Generate DTOs\n\n```bash\nphp artisan dto:generate\n```\n\nOptions:\n- `--dry-run` - Preview changes without writing files\n- `-v` - Verbose output\n\n### 3. Use your DTOs\n\n```php\nuse App\\Dto\\UserDto;\n\n$user = new UserDto();\n$user-\u003esetId(1);\n$user-\u003esetName('John Doe');\n$user-\u003esetEmail('john@example.com');\n\nreturn response()-\u003ejson($user-\u003etoArray());\n```\n\nOr create from an array:\n\n```php\n$user = UserDto::createFromArray([\n    'id' =\u003e 1,\n    'name' =\u003e 'John Doe',\n    'email' =\u003e 'john@example.com',\n]);\n```\n\n## Supported Config Formats\n\nThe package supports multiple config file formats:\n\n- `dto.xml` or `dtos.xml` - XML format\n- `dto.yml` / `dto.yaml` or `dtos.yml` / `dtos.yaml` - YAML format\n- `dtos.php` - PHP format (use `dtos.php` to avoid conflict with `config/dto.php`)\n- `dto/` subdirectory with multiple files\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-collective%2Flaravel-dto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp-collective%2Flaravel-dto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-collective%2Flaravel-dto/lists"}