- Can I use soyuka/json-schema-bundle in a Laravel application?
- Not directly. It is a Symfony2 bundle built around Symfony's DependencyInjection extension, configuration tree, services.yml, and AppKernel registration, none of which Laravel provides. The reusable part is the underlying justinrainbow/json-schema validator, which you can wrap in a Laravel service provider. Treat the bundle itself as Symfony-only.
- Does soyuka/json-schema-bundle support Laravel 10, 11, or 12?
- No. The bundle targets the Symfony 2.x and PHP 5.3 to 7.x era, while Laravel 10, 11, and 12 require PHP 8.1 or newer, so Composer is likely to report platform or constraint conflicts. Forcing installation with --ignore-platform-reqs or constraint overrides leaves you on an unsupported runtime. Use a maintained JSON Schema validator behind a Laravel integration instead.
- What PHP and Symfony versions does soyuka/json-schema-bundle target?
- It is a Symfony2-generation bundle from the PHP 5.3 to 7.x era. Symfony 2.8 reached end of life in 2018, so those constraints are not suitable for modern Laravel applications. Check the package's composer.json and transitive symfony/* constraints before considering any experiment.
- How do I install soyuka/json-schema-bundle?
- In a legacy Symfony application you would install it with Composer and register the bundle in AppKernel, then configure its services through the Symfony configuration tree. There is no Laravel installation path because Laravel has no bundle registration or Symfony DI extension equivalent. For Laravel, install justinrainbow/json-schema or a maintained alternative and bind it in a service provider.
- How do I validate JSON payloads against a JSON Schema in Laravel?
- Do not port the Symfony bundle. Install a validator such as justinrainbow/json-schema, opis/json-schema, or swaggest/php-json-schema, bind a configured validator instance in a Laravel service provider, and call it from a custom validation rule or Form Request. Map validation failures to a structured 422 response through Laravel's exception handler. Keep the third-party validator behind an internal interface so it can be replaced.
- Which JSON Schema draft should I support in a Laravel API?
- Confirm the draft required by your schemas before choosing a validator. The legacy justinrainbow/json-schema package is associated with older draft support, while modern APIs often need draft-07 or 2020-12, which opis/json-schema and swaggest/php-json-schema handle better. A draft mismatch can cause false passes or false failures on real payloads. Test representative schemas against the chosen validator.
- Does JSON Schema validation introduce SSRF risk with remote $ref resolution?
- Yes, if the validator resolves remote $ref URLs. Remote resolution can create SSRF and latency failure modes in a request-validation path. Disable remote resolution by default, allowlist trusted hosts if you must use it, or bundle local schema files. This policy belongs in your Laravel config and should be covered by tests.
- What are the best alternatives to soyuka/json-schema-bundle for Laravel?
- Use justinrainbow/json-schema only through a thin Laravel wrapper if you specifically need that library, and verify its maintenance and draft support first. For new work, prefer maintained validators such as opis/json-schema or swaggest/php-json-schema. A small service provider, config file for schema paths and $ref policy, a validation rule, and a 422 exception mapping are usually enough. This gives Laravel-native integration without Symfony bundle conventions.
- Is soyuka/json-schema-bundle actively maintained and production-ready?
- The available signals are weak: very few stars, no dependents, a Symfony2-generation codebase, and no meaningful community around the bundle. Running unmaintained code in a request-validation path creates security, SCA, and upgrade-drag risk. Verify the license and transitive dependencies, including the pinned justinrainbow/json-schema version, before any fork or internal adaptation. For most Laravel teams the bundle is not recommended for production.
- How should I test JSON Schema validation in a Laravel app?
- Unit test your validator wrapper with valid and invalid fixture payloads, including edge cases for the supported draft and $ref policy. Feature test the custom rule or Form Request to assert that failures return the expected 422 structure and error messages. Keep schemas local during tests so the suite does not depend on network resolution. Also test that the validator can be swapped behind your internal interface.