Implement Symfony/constraint/validation As Assert In Laravel/doctrine

For a new project, I am using Laravel/Doctrine.

All works well, I implement the Auth Services too.

I use symfony a lot, so I was wondering if there is a way to implement the Symfony validations constraints for doctrine in laravel, or anything else like this symfony component in Laravel.

In order to use in my doctrine entities like this:

use Symfony\Component\Validator\Constraints as Assert;

class Test
     * @Assert\Email(
     *     message = "The email '{{ value }}' is not a valid email.",
     *     checkMX = true
     * )
     protected $email;

Is there a way to show me how to make this in the good practices?



I think doctrine doesn't even "know" about symfonys Validator Constraints. It is the DoctrineBundle glueing symfony/validator.

So maybe you could install the symfony/validator and do the glue code yourself.

Here is the DIC config that bind the validator to doctrine: