PHPackages                             phpgt/input - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. phpgt/input

ActiveLibrary[Security](/categories/security)

phpgt/input
===========

Encapsulated user input.

v1.3.2(1y ago)315.8k↑19.2%2[3 issues](https://github.com/PhpGt/Input/issues)[3 PRs](https://github.com/PhpGt/Input/pulls)2MITPHPPHP &gt;=8.3CI passing

Since Dec 1Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/PhpGt/Input)[ Packagist](https://packagist.org/packages/phpgt/input)[ GitHub Sponsors](https://github.com/sponsors/PhpGt)[ RSS](/packages/phpgt-input/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (30)Used By (2)

Encapsulated and type-safe user input.
======================================

[](#encapsulated-and-type-safe-user-input)

By 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.

This library wraps user input in objects that promote encapsulation, allowing functions to be passed only the user input they require, rather than having unmitigated read/write access to everything.

Type-safe functions allow more predictable functionality, such as `$input->getFileUpload("photo")`, `$input->getDateTime("date-of-birth")`, and `$input->getMultipleString("pizza-topping")`.

---

[ ![PHP.Gt/Input build status](https://camo.githubusercontent.com/61f18a4772b2518283105d236bb979e8c29e7d0d19926b0449e2eb1d37d79536/68747470733a2f2f62616467652e7374617475732e7068702e67742f696e7075742d6275696c642e737667)](https://github.com/PhpGt/Input/actions)[ ![PHP.Gt/Input code quality](https://camo.githubusercontent.com/978fb4d6f5ab93ff4422f91b652d9e528fb9bf98a07a6c718ed96a7216c463e3/68747470733a2f2f62616467652e7374617475732e7068702e67742f696e7075742d7175616c6974792e737667)](https://app.codacy.com/gh/PhpGt/Input)[ ![PHP.Gt/Input code coverage](https://camo.githubusercontent.com/f11a48734f1d2dfde673f680d2bd98d6a41820657a29d8f673984e6ea2d9c6d8/68747470733a2f2f62616467652e7374617475732e7068702e67742f696e7075742d636f7665726167652e737667)](https://app.codecov.io/gh/PhpGt/Input)[ ![PHP.Gt/Input latest release](https://camo.githubusercontent.com/54a0ff3d34127e165fdff39497cdea677f5d4c76d8c4678004ea75108ae554cc/68747470733a2f2f62616467652e7374617475732e7068702e67742f696e7075742d76657273696f6e2e737667)](https://packagist.org/packages/phpgt/input)[ ![PHP.G/Input documentation](https://camo.githubusercontent.com/6917475f354af439aa5760a54e3ece6d660705da09be7f0509bcb22f0f20e2d0/68747470733a2f2f62616467652e7374617475732e7068702e67742f696e7075742d646f63732e737667)](http://www.php.gt/input)Example usage
-------------

[](#example-usage)

```

	User Profile

		Your name

		Age

		Interests

			Mathematics
			Cryptography
			Information Security
			Cyberwarfare

		Photo

	Save profile

```

```
