- What does danilopolani/laravel-json-validation-testing do?
- It is a Laravel package that adds convenient assertions for JSON validation error responses in your test suite. Instead of manually inspecting a 422 payload, you can verify status codes, error keys, and field-level messages with expressive test helpers. It is aimed at API developers who want clearer, more reliable validation-error tests.
- How do I install laravel-json-validation-testing?
- Install it as a dev dependency with composer require --dev danilopolani/laravel-json-validation-testing. Because it targets testing, keeping it in require-dev is the correct placement. Laravel package auto-discovery should handle anything the package registers, but check the README for optional publishable config.
- Which Laravel versions does this package support?
- The v2.x line targets current Laravel majors, and v2.2.0 added Laravel 13 support. Check the package's composer.json to confirm exactly which illuminate/* constraints are allowed. If you are on an older major, verify whether 2.2.0 widened the constraint or replaced it.
- Does laravel-json-validation-testing support Laravel 13?
- Yes, v2.2.0 explicitly added Laravel 13 support per the changelog. The changelog records only that addition, so confirm in the repository whether the Composer constraint was widened to keep older majors or narrowed to 13 only. Also check whether Laravel 13 was GA and which 13.x patch the CI matrix tested.
- How do I assert JSON validation errors in a Laravel test with this package?
- Typically you make a JSON request in a feature test, then chain the package's assertion helpers on the response. The helpers are designed to reduce boilerplate when checking 422 responses, error keys, and field messages. Consult the README for exact method names, since those assertions are the package's API surface.
- Can I check that a specific field has a specific validation message?
- Yes, asserting JSON validation error payloads, including per-field messages, is the package's core purpose. You assert that the field key exists and that its message matches what your FormRequest rules or translations produce. Keep messages in sync with your rules to avoid brittle tests.
- Is this package suitable for production use, or only tests?
- It is a testing utility, so it belongs in require-dev and only runs inside your test suite. It does not change your application's runtime behavior in production. Avoid shipping it as a production dependency.
- How does it compare to Laravel's built-in assertJsonValidationErrors?
- Laravel ships assertJsonValidationErrors and assertJsonMissingValidationErrors, which cover common validation-error cases out of the box. This package adds more granular helpers around error payload structure and field messages, cutting repeated assertions. If the built-ins already cover your needs, the package is optional, so weigh the extra expressiveness against one more dependency.
- Do I need to publish config or register a service provider?
- Most Laravel testing packages rely on package auto-discovery, so manual provider registration is usually unnecessary. Any publishable configuration would be optional and documented in the README. Confirm by checking the package's service provider and composer.json before assuming.
- Is the package actively maintained, and what is the upgrade path for 2.2.0?
- The v2.2.0 release adding Laravel 13 support signals the package is tracking Laravel's annual major cadence. Upgrading is usually a minor Composer bump with no code changes, but verify the constraint and any PHP minimum change first. For production confidence, check CI status for the Laravel 13 job and any issues opened after 2.2.0.