{"id":20678882,"url":"https://github.com/phpgt/input","last_synced_at":"2025-04-19T23:45:28.748Z","repository":{"id":26831829,"uuid":"109600207","full_name":"phpgt/Input","owner":"phpgt","description":"Encapsulated and type-safe user input.","archived":false,"fork":false,"pushed_at":"2025-03-26T12:00:12.000Z","size":378,"stargazers_count":3,"open_issues_count":10,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-19T23:45:24.679Z","etag":null,"topics":["encapsulation","encryption","file-upload","php-security","querystring","security","stream","user-input"],"latest_commit_sha":null,"homepage":"https://www.php.gt/input","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/phpgt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","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},"funding":{"github":["phpgt"]}},"created_at":"2017-11-05T17:24:30.000Z","updated_at":"2025-03-26T11:41:46.000Z","dependencies_parsed_at":"2024-06-21T12:55:34.920Z","dependency_job_id":"656564ac-d1d1-41f9-a0af-4ccc59d08894","html_url":"https://github.com/phpgt/Input","commit_stats":{"total_commits":247,"total_committers":6,"mean_commits":"41.166666666666664","dds":0.1659919028340081,"last_synced_commit":"e348ebdddea96be945318781b070a5c52b46f90b"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FInput","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FInput/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FInput/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FInput/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phpgt","download_url":"https://codeload.github.com/phpgt/Input/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249830845,"owners_count":21331357,"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":["encapsulation","encryption","file-upload","php-security","querystring","security","stream","user-input"],"created_at":"2024-11-16T21:22:55.183Z","updated_at":"2025-04-19T23:45:28.730Z","avatar_url":"https://github.com/phpgt.png","language":"PHP","readme":"Encapsulated and type-safe user input.\n======================================\n\nBy default, PHP stores all user input in global arrays (`$_GET`, `$_POST`, and `$_FILES`) available for reading and _modification_ in any code, including third party libraries.\n\nThis library wraps user input in objects that promote encapsulation, allowing functions to be\npassed only the user input they require, rather than having unmitigated read/write access to everything.\n\nType-safe functions allow more predictable functionality, such as `$input-\u003egetFileUpload(\"photo\")`, `$input-\u003egetDateTime(\"date-of-birth\")`, and `$input-\u003egetMultipleString(\"pizza-topping\")`.\n\n***\n\n\u003ca href=\"https://github.com/PhpGt/Input/actions\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://badge.status.php.gt/input-build.svg\" alt=\"PHP.Gt/Input build status\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://app.codacy.com/gh/PhpGt/Input\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://badge.status.php.gt/input-quality.svg\" alt=\"PHP.Gt/Input code quality\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://app.codecov.io/gh/PhpGt/Input\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://badge.status.php.gt/input-coverage.svg\" alt=\"PHP.Gt/Input code coverage\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/phpgt/input\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://badge.status.php.gt/input-version.svg\" alt=\"PHP.Gt/Input latest release\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"http://www.php.gt/input\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://badge.status.php.gt/input-docs.svg\" alt=\"PHP.G/Input documentation\" /\u003e\n\u003c/a\u003e\n\nExample usage\n-------------\n\n```html\n\u003cform method=\"post\"\u003e\n\t\u003ch1\u003eUser Profile\u003c/h1\u003e\n\t\u003clabel\u003e\n\t\t\u003cspan\u003eYour name\u003c/span\u003e\n\t\t\u003cinput name=\"name\" placeholder=\"e.g. Eugene Kaspersky\" required /\u003e\t\n\t\u003c/label\u003e\n\n\t\u003clabel\u003e\n\t\t\u003cspan\u003eAge\u003c/span\u003e\n\t\t\u003cinput type=\"number\" name=\"age\" /\u003e\n\t\u003c/label\u003e\n\t\n\t\u003clabel\u003e\n\t\t\u003cspan\u003eInterests\u003c/span\u003e\n\t\t\u003cselect name=\"interest[]\" multiple\u003e\n\t\t\t\u003coption\u003eMathematics\u003c/option\u003e\n\t\t\t\u003coption\u003eCryptography\u003c/option\u003e\n\t\t\t\u003coption\u003eInformation Security\u003c/option\u003e\n\t\t\t\u003coption\u003eCyberwarfare\u003c/option\u003e\n\t\t\u003c/select\u003e\n\t\u003c/label\u003e\n\t\n\t\u003clabel\u003e\n\t\t\u003cspan\u003ePhoto\u003c/span\u003e\n\t\t\u003cinput name=\"photo\" type=\"file\" /\u003e\n\t\u003c/label\u003e\n\t\n\t\u003cbutton name=\"do\" value=\"save\"\u003eSave profile\u003c/button\u003e\n\u003c/form\u003e\n```\n\n```php\n\u003c?php\n$profile-\u003eupdate(\n\t$profileId,\n// Use type-safe getters to help write maintainable code.\n\t$input-\u003egetString(\"name\"),\n\t$input-\u003egetInt(\"age\"),\n);\n\n// Handle multiple values with type safety.\nforeach($input-\u003egetMultipleString(\"interest\") as $interest) {\n\t$profile-\u003eaddInterest($interest);\n}\n\n// Handle file uploads with a FileUpload object.\n$photoUpload = $input-\u003egetFile(\"photo\");\nif($photoUpload instanceof FailedFileUpload) {\n\t// Handle a failed upload here.\n}\n\n$photoUpload-\u003emoveTo(\"data/upload/$profileId.jpg\");\n```\n\nFeatures at a glance\n--------------------\n\n+ Type-safe getters, implementing the [TypeSafeGetter][tsg] interface.\n+ Typed `multiple` getters, for working with checkboxes, multi-select elements or multiple file uploads.\n+ \"do\" callback functions - hook up callbacks to button presses (implemented automatically in WebEngine applications).\n+ \"when\" triggers - execute callbacks when certain user input is present.\n+ `FileUploadInputData` class for easy file uploads, including functions such as `moveTo()`, `getOriginalName()`, etc.\n+ Coming soon: working with huge files by streaming them to PHP, efficiently managing memory in the process.\n\n[tsg]: https://php.gt/typesafegetter\n","funding_links":["https://github.com/sponsors/phpgt"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpgt%2Finput","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpgt%2Finput","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpgt%2Finput/lists"}