toa/validator-bundle
A Symfony bundle that integrates the Toa validator library, registering validation services in the container and providing configuration for defining and applying validation rules across your application. Keeps validation setup declarative, reusable, and framework-native.
Install with Composer, pinning a constraint that matches your Symfony version:
composer require toa/validator-bundle
Given the package targets Symfony2, expect a constraint like ~2.0 or dev-master and a PHP requirement of 5.3–7.x.
Register the bundle in app/AppKernel.php:
public function registerBundles()
{
$bundles = array(
// ...
new Toa\ValidatorBundle\ToaValidatorBundle(),
);
}
Confirm the exact class name and namespace from the package's composer.json (autoload.psr-4 / autoload.psr-0) before assuming Toa\ValidatorBundle — the vendor name in the Composer package (toa) may not match the PHP namespace.
Where to look first, in order:
README.md — treat as aspirational; this package has zero stars and zero dependents, so nothing here is battle-tested.DependencyInjection/Configuration.php and DependencyInjection/*Extension.php — this is the authoritative list of config keys under the bundle's root alias.Resources/config/services.xml (or services.yml) — the authoritative list of service IDs you can actually fetch.composer.json of both this bundle and toaotc/Validator — version constraints and PHP floor.First use case: wire the bundle's validator service into a controller action and validate a simple DTO or entity, then dump the result to confirm the service is registered and behaving as expected:
$validator = $this->get('toa.validator'); // verify ID via container:debug
$result = $validator->validate($someDto);
Run php app/console container:debug (Symfony 2.x) and grep for toa to find the real service IDs before writing integration code.
$this->get(...)) work but make the bundle hard to swap later.validator service handles constraints/annotations; this bundle is a separate validation engine. Use Symfony's validator for entity/form constraints and this bundle for domain-rule validation, or write a thin adapter that exposes its rules as a Symfony ConstraintValidator.app/config/config.yml and let the extension build the validator service. Keep environment-specific rule sets in config_dev.yml / config_prod.yml.toaotc/Validator API (fast, no kernel). For wiring, use Symfony's KernelTestCase/WebTestCase to boot the kernel and assert the service resolves — this catches DI misconfiguration that unit tests miss.services.yml and drop the bundle registration, since auto-wiring and services.yaml defaults won't apply.services.xml, explicit public: true services, and the app/console layout. Don't expect PSR-4 autoloading of services, autoconfigure, or Flex recipes.composer.json before editing AppKernel.php; a wrong new ... line produces a confusing "class not found" at boot.toaotc/Validator may be abandoned or pin an old PHP version. Run composer why-not php <your-version> and inspect the upstream repo's last commit date before committing to it.container:debug | grep -i toa (or debug:container on newer consoles) is faster than reading XML by hand.var_dumps the outcome.vendor/. If the bundle's extension doesn't expose what you need, decorate the service in your own services.yml.toa_validator vs. toa_validator_bundle), the Configuration.php getConfigTreeBuilder()->root(...) call is the single source of truth.How can I help you explore Laravel packages today?