{"id":14966446,"url":"https://github.com/yiisoft/input-http","last_synced_at":"2025-10-19T09:31:19.773Z","repository":{"id":164587382,"uuid":"633350878","full_name":"yiisoft/input-http","owner":"yiisoft","description":"Provides Yii Hydrator attributes to get data from PSR-7 HTTP request and adds extra abilities to middlewares processed by Yii Middleware Dispatcher.","archived":false,"fork":false,"pushed_at":"2024-04-08T15:15:10.000Z","size":73,"stargazers_count":10,"open_issues_count":2,"forks_count":2,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-04-13T23:13:21.778Z","etag":null,"topics":["http","hydrator","middleware","yii3"],"latest_commit_sha":null,"homepage":"https://www.yiiframework.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yiisoft.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"open_collective":"yiisoft","github":["yiisoft"]}},"created_at":"2023-04-27T10:04:38.000Z","updated_at":"2024-04-13T23:13:21.779Z","dependencies_parsed_at":"2023-09-24T11:57:57.080Z","dependency_job_id":"2a7b1c5e-bf72-4523-8bcc-d175e316afe8","html_url":"https://github.com/yiisoft/input-http","commit_stats":{"total_commits":30,"total_committers":6,"mean_commits":5.0,"dds":0.6,"last_synced_commit":"b7d8bc1ee686c3aea193096e8a27ebb31a9a0574"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":"yiisoft/package-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Finput-http","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Finput-http/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Finput-http/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Finput-http/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yiisoft","download_url":"https://codeload.github.com/yiisoft/input-http/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219869245,"owners_count":16555571,"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":["http","hydrator","middleware","yii3"],"created_at":"2024-09-24T13:36:23.891Z","updated_at":"2025-10-19T09:31:19.398Z","avatar_url":"https://github.com/yiisoft.png","language":"PHP","readme":"\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/yiisoft\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://yiisoft.github.io/docs/images/yii_logo.svg\" height=\"100px\" alt=\"Yii\"\u003e\n    \u003c/a\u003e\n    \u003ch1 align=\"center\"\u003eYii Input HTTP\u003c/h1\u003e\n    \u003cbr\u003e\n\u003c/p\u003e\n\n[![Latest Stable Version](https://poser.pugx.org/yiisoft/input-http/v)](https://packagist.org/packages/yiisoft/input-http)\n[![Total Downloads](https://poser.pugx.org/yiisoft/input-http/downloads)](https://packagist.org/packages/yiisoft/input-http)\n[![Build status](https://github.com/yiisoft/input-http/actions/workflows/build.yml/badge.svg)](https://github.com/yiisoft/input-http/actions/workflows/build.yml)\n[![Code Coverage](https://codecov.io/gh/yiisoft/input-http/branch/master/graph/badge.svg)](https://codecov.io/gh/yiisoft/input-http)\n[![Mutation testing badge](https://img.shields.io/endpoint?style=flat\u0026url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fyiisoft%2Finput-http%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/yiisoft/input-http/master)\n[![static analysis](https://github.com/yiisoft/input-http/workflows/static%20analysis/badge.svg)](https://github.com/yiisoft/input-http/actions?query=workflow%3A%22static+analysis%22)\n[![type-coverage](https://shepherd.dev/github/yiisoft/input-http/coverage.svg)](https://shepherd.dev/github/yiisoft/input-http)\n[![psalm-level](https://shepherd.dev/github/yiisoft/input-http/level.svg)](https://shepherd.dev/github/yiisoft/input-http)\n\nThe package provides [Yii Hydrator](https://github.com/yiisoft/hydrator) attributes\nto get data from [PSR-7 HTTP request](https://www.php-fig.org/psr/psr-7/) and adds extra abilities to middlewares\nprocessed by [Yii Middleware Dispatcher](https://github.com/yiisoft/middleware-dispatcher):\n\n- maps data from PSR-7 HTTP request to PHP DTO representing user input;\n- uses Yii Hydrator parameter attributes for resolving middleware parameters.\n\n## Requirements\n\n- PHP 8.1 or higher.\n\n## Installation\n\nThe package could be installed with [Composer](https://getcomposer.org):\n\n```shell\ncomposer require yiisoft/input-http\n```\n\n## General usage\n\nYii Input HTTP allows having DTO with attributes like this:\n\n```php\nuse Yiisoft\\Input\\Http\\AbstractInput;\nuse Yiisoft\\Input\\Http\\Attribute\\Data\\FromBody;\n\n#[FromBody]\nfinal class UpdatePostInput extends AbstractInput\n{\n    public int $id;\n    public string $title;\n    public string $description = '';\n    public string $content;\n}\n```\n\nand automatically resolve and hydrate it, for example, for arguments like that:\n\n```php\nfinal class UpdatePostController\n{\n    public function update(UpdatePostInput $post): ResponseInterface\n    {\n        // ...\n        \n        /** @var ResponseInterface $response */\n        return $response;\n    }\n}\n```\n\nNote that `FromBody` attribute assumes that request body is parsed. If your implementation of request doesn't parse body\nautomatically, you can use [yiisoft/request-body-parser](https://github.com/yiisoft/request-body-parser) middleware\nto prepare it.\n\nBasic steps:\n\n- Configure [storing request](https://github.com/yiisoft/request-provider?tab=readme-ov-file#general-usage).\n- Configure [parameters resolver](docs/guide/en/parameters-resolvers.md).\n- Create DTO ([request input](docs/guide/en/request-input.md)).\n- Mark DTO properties with [hydrator attributes](docs/guide/en/hydrator-attributes.md) provided by this package.\n- Add DTO class name as a type hint to a class method argument where you want to it to be resolved.\n\n## Documentation\n\n- Guide: [English](docs/guide/en/README.md), [Português - Brasil](docs/guide/pt-BR/README.md).\n- [Internals](docs/internals.md)\n\nIf you need help or have a question, the [Yii Forum](https://forum.yiiframework.com/c/yii-3-0/63) is a good place for that.\nYou may also check out other [Yii Community Resources](https://www.yiiframework.com/community).\n\n## License\n\nThe Yii Input HTTP is free software. It is released under the terms of the BSD License.\nPlease see [`LICENSE`](./LICENSE.md) for more information.\n\nMaintained by [Yii Software](https://www.yiiframework.com/).\n\n## Support the project\n\n[![Open Collective](https://img.shields.io/badge/Open%20Collective-sponsor-7eadf1?logo=open%20collective\u0026logoColor=7eadf1\u0026labelColor=555555)](https://opencollective.com/yiisoft)\n\n## Follow updates\n\n[![Official website](https://img.shields.io/badge/Powered_by-Yii_Framework-green.svg?style=flat)](https://www.yiiframework.com/)\n[![Twitter](https://img.shields.io/badge/twitter-follow-1DA1F2?logo=twitter\u0026logoColor=1DA1F2\u0026labelColor=555555?style=flat)](https://twitter.com/yiiframework)\n[![Telegram](https://img.shields.io/badge/telegram-join-1DA1F2?style=flat\u0026logo=telegram)](https://t.me/yii3en)\n[![Facebook](https://img.shields.io/badge/facebook-join-1DA1F2?style=flat\u0026logo=facebook\u0026logoColor=ffffff)](https://www.facebook.com/groups/yiitalk)\n[![Slack](https://img.shields.io/badge/slack-join-1DA1F2?style=flat\u0026logo=slack)](https://yiiframework.com/go/slack)\n","funding_links":["https://opencollective.com/yiisoft","https://github.com/sponsors/yiisoft"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyiisoft%2Finput-http","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyiisoft%2Finput-http","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyiisoft%2Finput-http/lists"}