Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f23d0df
test: establish RED baseline for workstream 0
yordadev Sep 8, 2026
1d1fe39
chore: keep v1.1 platform and CI configuration
yordadev Sep 8, 2026
ccf188a
feat: allow null chunkSize to opt into dynamic heuristic
yordadev Sep 8, 2026
2dfbe23
fix: use intdiv in optimizeForLargeDataset to avoid float coercion
yordadev Sep 8, 2026
939b3c7
test: make the intdiv fix genuinely testable
yordadev Sep 8, 2026
3cdb4ed
fix: use integer offset when evicting the parsed rules cache
yordadev Sep 8, 2026
2f67a35
fix: make determineChunkSize null-safe and floor it at one
yordadev Sep 8, 2026
f52bbd6
refactor: drop the unused by-reference marker on applyRules data
yordadev Sep 8, 2026
56eeb21
test: fail the suite on PHP warnings
yordadev Sep 8, 2026
26adcf7
feat: accept a DataValidationConfig in Validator::isValid
yordadev Sep 8, 2026
690118f
fix: make passes() and fails() validate on first use
yordadev Sep 8, 2026
2686fd5
feat: add optional Laravel service provider
yordadev Sep 8, 2026
76e971a
style: wrap lines exceeding PSR-12's 120-character limit in src/
yordadev Sep 9, 2026
3feaa6f
chore: pin composer platform to PHP 8.3 for matrix compatibility
yordadev Sep 9, 2026
382c226
fix: mark validation complete on return, not on entry
yordadev Sep 9, 2026
95265e5
test: guard the serialization of the hasValidated flag
yordadev Sep 9, 2026
faa754b
test: verify the published config path resolves
yordadev Sep 9, 2026
98c72ea
test: name the harness dependency on failOnDeprecation/failOnWarning
yordadev Sep 9, 2026
8259f23
docs: document the hasValidated invariant above validationPassed()
yordadev Sep 9, 2026
8e0d17a
test: narrow the stated purpose of testValidatorIsValidSupportsConfig…
yordadev Sep 9, 2026
6c25efd
fix: prevent re-entrant validation from recursing
yordadev Sep 9, 2026
18f3cec
chore: ignore local planning docs
yordadev Sep 9, 2026
e5a37b0
fix: validate each field against its own value and reset completion s…
yordadev Sep 9, 2026
511966c
test: cover the Laravel integration against a real application
yordadev Sep 9, 2026
250b626
ci: run the Laravel matrix without a coverage driver
yordadev Sep 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: 'Dependency Review'
uses: actions/dependency-review-action@v2
6 changes: 3 additions & 3 deletions .github/workflows/fix-php-code-style-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
php-version: '8.5'
tools: composer

- name: Install dependencies
Expand All @@ -27,4 +27,4 @@ jobs:
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Fix styling to adhere to PSR12 standards.
commit_message: Fix styling to adhere to PSR12 standards.
76 changes: 72 additions & 4 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@ on:
pull_request:

jobs:
# The default dependency set: laravel/framework ^12 || ^13 is installed, so
# the provider's boot() is exercised against a real Illuminate application.
test:
name: PHP ${{ matrix.php-version }} - locked deps
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version: ['8.3', '8.4']
php-version: ['8.3', '8.4', '8.5']

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up PHP
uses: shivammathur/setup-php@v2
Expand All @@ -25,7 +29,71 @@ jobs:
coverage: xdebug

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
run: composer install --prefer-dist --no-progress --no-interaction

- name: Run PHPUnit
run: vendor/bin/phpunit --testdox
run: vendor/bin/phpunit --testdox

# Every Laravel major the package claims to support, resolved from scratch.
#
# This job answers "does the suite pass against this dependency set", so it
# runs without a coverage driver. phpunit.xml sets failOnWarning, and PHPUnit
# warns when a coverage driver is missing, so --no-coverage is required here
# rather than optional -- without it the job fails on the warning alone while
# every test passes.
#
# Laravel 10 and 11 use the split illuminate/* packages deliberately: every
# laravel/framework release in those ranges is withheld by Composer's
# security-advisory policy, and the alternative would be disabling that check.
# The advisories do not apply to the split packages, so those majors are still
# exercised here -- they just cannot supply a real Application, and the
# boot() tests skip themselves accordingly.
laravel-majors:
name: Laravel ${{ matrix.laravel }} - PHP ${{ matrix.php-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version: ['8.3', '8.5']
laravel: ['10', '11', '12', '13']

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: zip, intl
coverage: none

- name: Pin the Laravel major
run: |
# laravel/framework replaces the illuminate/* split packages, so the
# two cannot both be constrained at once. Drop it for the majors whose
# framework releases are advisory-blocked, and pin it for the rest.
if [ "${{ matrix.laravel }}" -le 11 ]; then
composer remove --dev laravel/framework --no-update --no-interaction
else
composer require --dev "laravel/framework:^${{ matrix.laravel }}.0" \
--no-update --no-interaction
fi

for pkg in support validation filesystem translation config; do
composer require --dev "illuminate/${pkg}:^${{ matrix.laravel }}.0" \
--no-update --no-interaction
done

- name: Resolve dependencies
run: |
composer update --with-all-dependencies \
--prefer-dist --no-progress --no-interaction

- name: Show what actually resolved
# illuminate/support is not separately installed when laravel/framework
# is present -- the framework replaces it -- so list whichever is there.
run: composer show | grep -E '^(laravel/framework|illuminate/support) ' || true

- name: Run PHPUnit
run: vendor/bin/phpunit --testdox --no-coverage
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ clover.xml
/data-validation
*.cache
.phpunit.result.cache
docs/
11 changes: 7 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
FROM php:8.4-fpm
ARG PHP_VERSION=8.5
FROM php:${PHP_VERSION}-fpm

RUN apt-get update \
&& apt-get -y install libzip-dev zlib1g-dev git zip unzip libicu-dev \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

RUN docker-php-ext-configure zip && docker-php-ext-install zip intl
RUN docker-php-ext-configure zip \
&& docker-php-ext-install zip intl

# Install Xdebug only
RUN pecl install xdebug \
Expand All @@ -24,4 +27,4 @@ RUN chown -R www-data:www-data /var/www

# Expose port 9000 and start php-fpm server
EXPOSE 9000
CMD ["php-fpm"]
CMD ["php-fpm"]
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,24 @@ composer require yorcreative/data-validation
```

**Requirements**:
- PHP 8.3 or 8.4
- PHP 8.3, 8.4, or 8.5

### Optional Laravel Integration

The core library has **zero runtime framework dependencies**. When the package is installed inside a Laravel 10, 11, 12, or 13 application, an optional service provider (`YorCreative\DataValidation\Laravel\DataValidationServiceProvider`) is auto-discovered and binds:

- A shared `DataValidationConfig` singleton, hydrated from `config/data-validation.php`
- A `yorcreative.data-validation` factory closure that returns a `Validator` pre-configured from the container

Publish the config file to customize cache limits and chunk size:

```bash
php artisan vendor:publish --tag=data-validation-config
```

Set `chunk_size` to `null` if you want the validator to fall back to its dynamic wildcard chunking heuristic instead of a fixed override.

Outside of Laravel the provider class is never loaded — the library remains fully framework-agnostic.

## Basic Usage

Expand Down Expand Up @@ -191,6 +208,8 @@ if ($validator->fails()) {
}
```

`fails()` and `passes()` trigger validation on first use, so they can be used directly when you do not want to call `validate()` yourself.

## Extending with Custom Rules

For applications requiring bespoke validation logic, implement custom rules via `ValidationRuleInterface`:
Expand Down Expand Up @@ -311,4 +330,4 @@ Report issues or suggest features on the [GitHub repository](https://github.com/

## License

DataValidation is licensed under the MIT License. See the [LICENSE](https://github.com/yorcreative/data-validation/blob/main/LICENSE) file for details.
DataValidation is licensed under the MIT License. See the [LICENSE](https://github.com/yorcreative/data-validation/blob/main/LICENSE) file for details.
28 changes: 18 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,31 @@
"psr-12",
"psr-4",
"security",
"open-source ",
"open-source",
"no-dependencies",
"testing",
"enterprise",
"validator",
"benchmarks"
],
"require": {
"php": "^8.3|^8.4"
"php": "^8.3 || ^8.4 || ^8.5"
},
"require-dev": {
"orchestra/testbench": "^9.0|^10.0",
"phpunit/phpunit": "^10.0|^11.5.3",
"squizlabs/php_codesniffer": "^3.8.0",
"friendsofphp/php-cs-fixer": "^3.44.2",
"mockery/mockery": "^1.0",
"illuminate/validation": "^10.0 || ^11.0",
"symfony/translation": "^6.0 || ^7.0",
"illuminate/filesystem": "^10.0 || ^11.0",
"illuminate/translation": "^10.0 || ^11.0"
"illuminate/support": "^10.0 || ^11.0 || ^12.0 || ^13.0",
"illuminate/validation": "^10.0 || ^11.0 || ^12.0 || ^13.0",
"symfony/translation": "^6.0 || ^7.0 || ^8.0",
"illuminate/filesystem": "^10.0 || ^11.0 || ^12.0 || ^13.0",
"illuminate/translation": "^10.0 || ^11.0 || ^12.0 || ^13.0",
"illuminate/config": "^10.0 || ^11.0 || ^12.0 || ^13.0",
"laravel/framework": "^12.0 || ^13.0"
},
"suggest": {
"illuminate/support": "Required only when using the optional Laravel ServiceProvider (^10.0 || ^11.0 || ^12.0 || ^13.0)."
},
"autoload": {
"psr-4": {
Expand All @@ -53,7 +58,7 @@
},
"extra": {
"laravel": {
"providers": ["YorCreative\\DataValidation\\DataValidationServiceProvider"]
"providers": ["YorCreative\\DataValidation\\Laravel\\DataValidationServiceProvider"]
}
},
"scripts": {
Expand All @@ -66,6 +71,9 @@
"coverage-html": "php ./vendor/bin/phpunit --testdox --coverage-html data-validation"
},
"config": {
"process-timeout": 0
"process-timeout": 0,
"platform": {
"php": "8.3.0"
}
}
}
}
Loading
Loading