Download the PHP package cryonighter/validation-override-bundle without Composer

On this page you can find all versions of the php package cryonighter/validation-override-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package validation-override-bundle

Validation Override Bundle

Latest Version on Packagist Total Downloads

A Symfony bundle that allows dynamic modification of validation constraints at runtime via a provider pattern, without touching the validated class itself.

Description

Symfony's validator loads constraints from PHP attributes, YAML, or XML and caches them. There is no standard extension point to modify these constraints dynamically — for example, based on runtime conditions, environment flags, or external configuration.

This bundle solves this by intercepting the validator's metadata factory and passing the loaded ClassMetadata through a chain of DynamicRulesProviderInterface providers before validation occurs. Each provider can add, remove, or replace constraints for a specific class.

When this bundle is appropriate:

When to consider alternatives:

Requirements

Installation

1. Install via Composer

2. Register the bundle

If Symfony Flex did not register the bundle automatically, add it manually:

No additional configuration is required. The bundle registers the validator decorator automatically.

Usage

Step 1 — Create a provider

Implement DynamicRulesProviderInterface. The bundle will auto-tag all implementations via _instanceof — no services.yaml entry is needed unless you require a specific priority.

Step 2 — Use the validator as usual

No changes to your validation call are required:

The bundle transparently intercepts the validation pipeline and applies your providers.

Controlling provider order

If multiple providers modify the same class, use priority to define the order. Higher priority runs first:

How It Works

Symfony builds the validator via ValidatorBuilder::getValidator() internally. The resulting LazyLoadingMetadataFactory is not exposed as a standalone service in the DI container and cannot be decorated via standard Symfony means.

This bundle works around this limitation with the following approach:

  1. DynamicValidatorDecorator decorates the validator service
  2. On the first validation call, it uses SymfonyInternalsAccessor to locate and replace the MetadataFactoryInterface property inside RecursiveValidator via reflection
  3. DynamicMetadataFactory wraps the original factory — on each getMetadataFor() call it:
    • Asks the original factory for ClassMetadata (cached as usual by Symfony)
    • Deep-clones the metadata so providers never mutate the cached original
    • Passes the clone through all matching providers
    • Returns the modified clone to the validator

Limitations and Caveats

Implicit behavior

Providers are invisible to standard Symfony tooling. php bin/console debug:validator will show the original constraints defined on the class, not the modified ones. This is the main trade-off of this approach — document your providers thoroughly.

Reflection over Symfony internals

SymfonyInternalsAccessor uses reflection on private properties of TraceableValidator and RecursiveValidator. These are internal implementation details of Symfony and may change in any release. See UPGRADE.md for the compatibility checklist.

Provider isolation

Each provider receives a fresh deep clone of the original ClassMetadata. However, if two providers modify the same property of the same class, the second provider's changes will overwrite the first's — use priority to make the order explicit. Providers that operate on different properties do not interfere with each other.

Compatibility

Bundle version PHP Symfony
0.x ^8.2 ^8.0

Testing

Contributing

Please see CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of validation-override-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
symfony/framework-bundle Version ^8.0
symfony/validator Version ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package cryonighter/validation-override-bundle contains the following files

Loading the files please wait ...