Download the PHP package kariricode/sanitizer without Composer
On this page you can find all versions of the php package kariricode/sanitizer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kariricode/sanitizer
More information about kariricode/sanitizer
Files in kariricode/sanitizer
Package sanitizer
Short Description A robust and flexible data sanitization component for PHP, part of the KaririCode Framework, utilizing configurable processors and native functions.
License MIT
Homepage https://kariricode.org
Informations about the package sanitizer
KaririCode Framework: Sanitizer Component
A robust and flexible data sanitization component for PHP, part of the KaririCode Framework. It utilizes configurable processors and native functions to ensure data integrity and security in your applications.
Table of Contents
- Features
- Installation
- Usage
- Basic Usage
- Advanced Usage
- Available Sanitizers
- Integration with Other KaririCode Components
- Development and Testing
- License
- Support and Community
Features
- Flexible attribute-based sanitization for object properties
- Comprehensive set of built-in sanitizers for common use cases
- Easy integration with other KaririCode components
- Configurable processors for customized sanitization logic
- Support for fallback values in case of sanitization failures
- Extensible architecture allowing custom sanitizers
Installation
You can install the Sanitizer component via Composer:
Requirements
- PHP 8.3 or higher
- Composer
Usage
Basic Usage
-
Define your data class with sanitization attributes:
- Set up the sanitizer and use it:
Advanced Usage
You can create custom sanitizers by implementing the Processor
or ConfigurableProcessor
interfaces:
Available Sanitizers
The Sanitizer component provides various built-in sanitizers:
Input Sanitizers
- TrimSanitizer
- HtmlSpecialCharsSanitizer
- NormalizeLineBreaksSanitizer
- StripTagsSanitizer
Domain Sanitizers
- HtmlPurifierSanitizer
- JsonSanitizer
- MarkdownSanitizer
Security Sanitizers
- FilenameSanitizer
- SqlInjectionSanitizer
- XssSanitizer
Each sanitizer is designed to handle specific types of data and security concerns. For detailed information on each sanitizer, please refer to the documentation.
Integration with Other KaririCode Components
The Sanitizer component is designed to work seamlessly with other KaririCode components:
- KaririCode\Contract: Provides interfaces and contracts for consistent component integration.
- KaririCode\ProcessorPipeline: Utilized for building and executing sanitization pipelines.
- KaririCode\PropertyInspector: Used for analyzing and processing object properties with sanitization attributes.
Example of integration:
Development and Testing
For development and testing purposes, this package uses Docker and Docker Compose to ensure consistency across different environments. A Makefile is provided for convenience.
Prerequisites
- Docker
- Docker Compose
- Make (optional, but recommended for easier command execution)
Development Setup
-
Clone the repository:
-
Set up the environment:
-
Start the Docker containers:
- Install dependencies:
Available Make Commands
make up
: Start all services in the backgroundmake down
: Stop and remove all containersmake build
: Build Docker imagesmake shell
: Access the PHP container shellmake test
: Run testsmake coverage
: Run test coverage with visual formattingmake cs-fix
: Run PHP CS Fixer to fix code stylemake quality
: Run all quality commands (cs-check, test, security-check)
For a full list of available commands, run:
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support and Community
- Documentation: https://kariricode.org/docs/sanitizer
- Issue Tracker: GitHub Issues
- Community: KaririCode Club Community
Built with ❤️ by the KaririCode team. Empowering developers to create more secure and robust PHP applications.
All versions of sanitizer with dependencies
kariricode/contract Version ^2.7
kariricode/processor-pipeline Version ^1.1
kariricode/property-inspector Version ^1.0