Skip to content

Commit 91b5e44

Browse files
committed
docs: Add GEMINI.md project summary
1 parent c34799b commit 91b5e44

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

GEMINI.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Lemmon Validator Project Summary
2+
3+
This project is a lightweight, fluent validation library for PHP, inspired by Valibot and Zod. It provides a structured way to validate various data types, including associative arrays, plain arrays, strings, integers, and booleans, with support for coercion, required fields, default values, and `oneOf` constraints.
4+
5+
## Key Components:
6+
7+
* **`Validator.php`**: Acts as a factory for creating different validator instances (e.g., `isAssociative()`, `isArray()`, `isString()`).
8+
* **`SchemaValidator.php`**: Handles validation for associative arrays, allowing definition of a schema with `FieldValidator` instances. It supports `validate()` (throws exception) and `tryValidate()` (returns status, data, errors).
9+
* **`FieldValidator.php`**: An abstract base class for individual field validators. It defines common validation methods like `required()`, `default()`, `coerce()`, and `oneOf()`. Concrete validators extend this class and implement `coerceValue()` and `validateType()`.
10+
* **Specific Validators (e.g., `StringValidator.php`, `IntValidator.php`, `BoolValidator.php`, `ArrayValidator.php`)**: Implement the abstract methods from `FieldValidator.php` to provide type-specific validation and coercion logic.
11+
* **`ValidationException.php`**: Custom exception class used to report validation errors.
12+
13+
## Development Setup:
14+
15+
* **Dependencies**: Managed by Composer (`composer.json`).
16+
* **Testing**: Uses Pest PHP (`tests/ValidatorTest.php`).
17+
* **Code Style**: Enforced by PHP-CS-Fixer.
18+
* **Static Analysis**: Performed by PHPStan.
19+
* **Local Testing**: A `temp/` directory is used for ad-hoc CLI tests, with a `_bootstrap.php` file for common setup (Composer autoloader, Symfony ErrorHandler). The `temp/` directory is excluded from Git via `.gitignore`.
20+
* **Debugging**: `symfony/var-dumper` is included as a dev dependency for easy debugging.
21+
* **Error Handling**: `symfony/error-handler` is included as a dev dependency and registered in the bootstrap for improved error reporting.

0 commit comments

Comments
 (0)