diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..be263f5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +vendor/ + +composer.lock +.phpunit.cache/ diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..33ab49b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,19 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [1.0.0] - Initial Release + +### Added +- Initial extraction of the validation module into the standalone library `maatify/validation` +- Schema-based validation system +- Validation rules +- Validation result DTO +- Error code enums +- Schema abstraction +- Pagination and query validation helpers \ No newline at end of file diff --git a/HOW_TO_USE.md b/HOW_TO_USE.md index 2a97088..650a7ae 100644 --- a/HOW_TO_USE.md +++ b/HOW_TO_USE.md @@ -4,7 +4,7 @@ This guide explains **how to use the Validation module** in controllers and application flow. It assumes: -- The Validation module is available under the project namespace `App\Modules\Validation` +- The Validation module is available under the project namespace `Maatify\Validation` - `respect/validation` is installed - PHP 8.2+ - PHPStan level max compatibility is required @@ -25,9 +25,9 @@ Example: ### Step 2 — Validate the Input ```php -use App\Modules\Validation\Validator\RespectValidator; -use app\Modules\Validation\Schemas\AuthLoginSchema; -use app\Modules\Validation\ErrorMapper\SystemApiErrorMapper; +use Maatify\Validation\Validator\RespectValidator; +use Maatify\Validation\Schemas\AuthLoginSchema; +use Maatify\Validation\ErrorMapper\SystemApiErrorMapper; /** @var array $input */ $input = (array) $request->getParsedBody(); @@ -82,9 +82,9 @@ if (!$result->isValid()) { All schemas **must extend `AbstractSchema`**. ```php -use app\Modules\Validation\Schemas\AbstractSchema; -use app\Modules\Validation\Rules\RequiredStringRule; -use app\Modules\Validation\Enum\ValidationErrorCodeEnum; +use Maatify\Validation\Schemas\AbstractSchema; +use Maatify\Validation\Rules\RequiredStringRule; +use Maatify\Validation\Enum\ValidationErrorCodeEnum; final class ExampleSchema extends AbstractSchema { diff --git a/HOW_TO_USE_GUARDS.md b/HOW_TO_USE_GUARDS.md index 5d32be1..afcdfc2 100644 --- a/HOW_TO_USE_GUARDS.md +++ b/HOW_TO_USE_GUARDS.md @@ -56,7 +56,7 @@ without knowing anything about HTTP, JSON, or Validation internals. All guard-related denial reasons are expressed using: ```php -App\Validation\Enum\AuthErrorCodeEnum +Maatify\Validation\Enum\AuthErrorCodeEnum ```` Examples: @@ -74,7 +74,7 @@ Guards signal denial by throwing a typed exception. ### 📄 Example Exception ```php -use App\Validation\Enum\AuthErrorCodeEnum; +use Maatify\Validation\Enum\AuthErrorCodeEnum; use RuntimeException; final class AuthFailedException extends RuntimeException @@ -105,7 +105,7 @@ final class AuthFailedException extends RuntimeException ### 📄 Example Guard ```php -use App\Validation\Enum\AuthErrorCodeEnum; +use Maatify\Validation\Enum\AuthErrorCodeEnum; final class AuthorizationGuard { @@ -135,7 +135,7 @@ Guards are typically executed inside middleware or controller flow. ### 📄 Example Middleware Handler ```php -use App\Validation\ErrorMapper\SystemApiErrorMapper; +use Maatify\Validation\ErrorMapper\SystemApiErrorMapper; try { $guard->assertAllowed($permissionGranted); diff --git a/README.md b/README.md index 3cd9042..196335b 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ A **type-safe, framework-agnostic input validation module** built on top of **Respect/Validation**, designed for clean architecture, strict static analysis, and future extraction as a standalone library. -This module is used inside the Admin Control Panel but is **not coupled** to: +This module is designed for standalone usage and is **not coupled** to: - Authentication - Authorization (Guards) - Domain Logic diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..9d9a608 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,17 @@ +# Security Policy + +## Supported Versions + +The latest stable version receives security updates. + +| Version | Supported | +| ------- | --------- | +| 1.x | Yes | + +## Reporting a Vulnerability + +Please do not report security vulnerabilities through public GitHub issues. + +Instead, please report them privately by emailing [security@maatify.dev](mailto:security@maatify.dev). + +You should receive a response within 48 hours. If for some reason you do not, please follow up via email to ensure we received your original message. \ No newline at end of file