jawira / sanitizer
😷 Sanitize your objects with attributes.
Installs: 1 737
Dependents: 1
Suggesters: 0
Security: 0
Stars: 9
Watchers: 2
Forks: 1
Open Issues: 5
Requires
- php: ^8.1
- symfony/string: ^5.1 || ^6.0 || ^7.0
Requires (Dev)
- ergebnis/composer-normalize: ^2.43
- friendsofphp/php-cs-fixer: ^3.62
- jawira/skeleton: ^2.23
- pds/skeleton: ^1.0
- phpunit/phpunit: ^10.5.30
- vimeo/psalm: ^5.25
README
Sanitize your objects with attributes.
Usage
Add sanitizer attributes to your class:
use Jawira\Sanitizer\Attribute as Filter; class User { #[Filter\Trim] #[Filter\Title] public string $name; }
Call Sanitizer::sanitize
method to apply sanitizers:
use Jawira\Sanitizer\Sanitizer; $user = new User(); $user->name = ' BOB '; $sanitizer = new Sanitizer(); $sanitizer->sanitize($user); echo $user->name; // 'Bob'
Interface SanitizerInterface
is also available.
Documentation
https://jawira.github.io/sanitizer/
Install
composer require jawira/sanitizer
Security
Warning
Sanitization is not a replacement for a proper data validation mechanism and database constraints.
License
This library is licensed under the MIT license.
Packages from jawira
- jawira/doctrine-diagram-bundle
- Symfony Bundle to generate database diagrams.
- jawira/case-converter
- Convert strings between 13 naming conventions: Snake case, Camel case, Pascal case, Kebab case, Ada case, Train case, Cobol case, Macro case, Upper case, Lower case, Sentence case, Title case and Dot notation.
- jawira/emoji-catalog
- Get access to +3000 emojis as class constants.
- more...