spiks / user-input-processor
Denormalizer and validator for any kind of user input.
Installs: 70 766
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 14
Requires
- php: >= 8.1
- ext-mbstring: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.5
- jetbrains/phpstorm-attributes: ^1.0
- phpstan/phpstan: ^1.4
- phpstan/phpstan-phpunit: ^1.0
- phpstan/phpstan-strict-rules: ^1.1
- phpunit/phpunit: ^9.5
- psalm/plugin-phpunit: ^0.16.1
- vimeo/psalm: ^4.20
- dev-main
- 0.10.1
- 0.10.0
- 0.9.0
- 0.8.0
- 0.7.0
- 0.6.2
- 0.6.1
- 0.6.0
- 0.5.0
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.1
- 0.3.0
- 0.2.1
- 0.2.0
- 0.1.0
- 0.0.1
- dev-dependabot/composer/phpstan/phpstan-1.10.50
- dev-dependabot/npm_and_yarn/prettier-3.1.1
- dev-dependabot/github_actions/shivammathur/setup-php-2.28.0
- dev-dependabot/composer/phpunit/phpunit-9.6.15
- dev-dependabot/github_actions/wagoid/commitlint-github-action-5.4.4
- dev-dependabot/composer/phpstan/phpstan-strict-rules-1.5.2
- dev-dependabot/github_actions/actions/cache-3.3.2
- dev-dependabot/github_actions/hmarr/auto-approve-action-3.2.1
- dev-dependabot/github_actions/actions/checkout-4
- dev-dependabot/npm_and_yarn/prettier/plugin-xml-3.1.0
- dev-dependabot/composer/psalm/plugin-phpunit-0.18.4
- dev-dependabot/composer/vimeo/psalm-4.30.0
- dev-symfony-bundle
- dev-feature/logger
This package is auto-updated.
Last update: 2024-11-06 13:13:05 UTC
README
Denormalizes and validates any kind of user input, so it may be easily used in:
- HTML forms,
- APIs,
- console command arguments,
- ... and in a lot of other scenarios.
Installation
Warning: At this moment the library is being tested in real projects to detect possible problems in its design, so API changes are possible. Please wait for stable version.
PHP 8.1 or newer is required. The library is available in Packagist and may be installed with Composer:
composer require spiks/user-input-processor
Features
The main principles behind the library:
- Keep it simple. The library implements only necessary subset of features. It's easy to extend the library to add more. The library is designed as a base for your own implementation, it's not swiss knife that tries to do everything.
- Full type coverage for static analysis tools. Public API and the library internals follow the strictest rules of Psalm and PHPStan - most popular static analysis tools for PHP. We are designing the library keeping type safety in mind. You will appreciate it if you are using static analysis in your projects too.
Motivation
In our internal projects we use Symfony framework which offers Symfony Forms package for user input validation. Symfony Forms has a lot if disadvantages:
- Its internals are very complex,
- It's designed only for HTML forms, and it's not suitable for JSON APIs,
- It's pain to use Symfony Forms with static analysis tools,
- Difficult to maintain forms with complex logic within.
There aren't lots of alternative solutions for user input validation. That's why we decided to create our own.
Usage
This section will be written when we will be sure API and design is stable enough.