Download the PHP package fp/jsformvalidator-bundle without Composer
On this page you can find all versions of the php package fp/jsformvalidator-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package jsformvalidator-bundle
FpJsFormValidatorBundle
FpJsFormValidatorBundle converts Symfony form validation metadata into JavaScript validation rules and attaches client-side validators to rendered forms.
Development Moves To Svaroh/JsFormValidatorBundle
Active development continues at
Svaroh/JsFormValidatorBundle,
maintained by Svaroh, under the new Composer package
svaroh/jsformvalidator-bundle. That is a new package with its own version
history starting at 1.0, not a 2.0 of this one, and it renames the project's
identifiers from Fp/fp to Svaroh/svaroh, so switching over requires
changes in your application.
1.x stays here. This repository remains the home of the 1.x line and of the
fp/jsformvalidator-bundle package, and 1.8.0 stays available. With
development moved to Svaroh, 1.x receives no further fixes from the maintainers.
Pull requests against 1.x are still welcome here and will be merged.
Existing 1.x installations keep working and need no changes.
Status
This branch has been revived for the current PHP/Symfony baseline:
- PHP 8.4+ runtime support; CI currently verifies PHP 8.4, 8.5, and 8.6 nightly
- Symfony 8.x components as declared in
composer.json - Twig 3
- PHPUnit 13
- PHPStan static analysis
- PHP and JavaScript coverage thresholds
- PSR-4 autoloading from
src/
The old Symfony 2/3 + Assetic + Selenium test application was replaced upstream
by a newer Tests/app fixture. The maintained test commands now cover the PHP
model/factory/controller core, JavaScript constraints, and a Cypress smoke test
against the Symfony test application.
For older Symfony applications, use the historical branches:
- Symfony 5.4, 6.4, or 7.x:
1.7 - Symfony 4:
1.6 - Symfony 3.1:
1.5 - Symfony 3.0:
1.4 - Symfony 2.8 or 2.7:
1.3 - Symfony 2.6 or older:
1.2
Installation
Install the bundle with Composer:
If you are testing this revived branch before a tagged release, require the development branch explicitly:
Register the bundle in config/bundles.php:
Configuration
Validation is enabled for every form by default. You can disable it globally:
Per-form and per-field disabling is documented in Disabling validation.
UniqueEntity Route
If you use Symfony's Doctrine UniqueEntity constraint, import the bundle route:
Make sure your security configuration allows requests to this route.
JavaScript Assets
There are two common ways to load the JavaScript files.
Add an Encore Entry
Then include the entry in your template:
Import From Your Main JavaScript
Adjust the import path to your application structure.
Render Bundle Config And Form Models
After the scripts are loaded, render the generated config and queued form models:
If you need manual initialization for a specific form or event, see manual initialization.
Usage
After the bundle is registered, the form extension adds every enabled root form
to an internal queue. Calling init_js_validation() renders JavaScript models
for the queued forms:
You can pass false as the second argument to avoid automatic initialization on
page load:
Documentation
- Disabling validation
- Forms in sub-requests
- Manual initialization
Customization
This bundle finds related DOM elements for each Symfony form element and attaches an object validator to them. The validator contains the properties and methods that define the validation process for that form element.
If your form rendering is customized, start with custom rendering notes.
- Disable validation for a specified field
- Error display
- Get validation groups from a closure
- Getters validation
- The Callback constraint
- The Choice constraint callback
- Custom constraints
- Custom data transformers
- Checking entity uniqueness
- Form submit by JavaScript
- onValidate callback
- Run validation on custom event
- Collections validation
Development
The recommended development environment is the Nix shell:
It provides the latest PHP available in the pinned nixpkgs input, currently
PHP 8.5, with Xdebug coverage support, Composer, Node.js 24, npm, zip/unzip,
and Cypress runtime libraries. If flakes are not enabled globally, prefix Nix
commands with nix --extra-experimental-features "nix-command flakes".
For a fresh checkout:
If Cypress reports a missing binary, install it into the local cache:
You can also run commands without entering the shell:
Without Nix, install PHP 8.4 or newer, Composer, Node.js 24, npm, and the Cypress system dependencies locally before running the same commands.
To install vendors via Docker instead of host PHP/Composer:
Install or refresh Composer dependencies:
Run the PHP test suite:
Run PHPStan static analysis:
Run PHP coverage:
Run the JavaScript unit tests and Cypress browser smoke test:
Run JavaScript coverage:
Useful local checks:
The same maintained test, static-analysis, and coverage checks are also run by GitHub Actions on pushes and pull requests. Coverage runs generate Cobertura reports and upload them to GitHub Code Quality when workflow permissions allow.
The Docker stack uses PHP 8.5, Composer 2, and Node.js 24. It is maintained for dependency installation and ad hoc local commands; Nix remains the preferred environment for exact local parity with the documented checks.
All versions of jsformvalidator-bundle with dependencies
doctrine/persistence Version ^2.5 || ^3.0 || ^4.0
symfony/config Version ^5.4 || ^6.4 || ^7.0
symfony/dependency-injection Version ^5.4 || ^6.4 || ^7.0
symfony/doctrine-bridge Version ^5.4 || ^6.4 || ^7.0
symfony/form Version ^5.4 || ^6.4 || ^7.0
symfony/http-foundation Version ^5.4 || ^6.4 || ^7.0
symfony/http-kernel Version ^5.4 || ^6.4 || ^7.0
symfony/routing Version ^5.4 || ^6.4 || ^7.0
symfony/translation-contracts Version ^2.5 || ^3.0
symfony/validator Version ^5.4 || ^6.4 || ^7.0
twig/twig Version ^3.0
