use Illuminate\Support\Facades\Validator; $validator = Validator::make(['email' => $email], [ 'email' => 'required|email', ]);
use Symfony\Component\Validator\Validation; use Symfony\Component\Validator\Constraints\Length; use Symfony\Component\Validator\Constraints\NotBlank; $validator = Validation::createValidator(); $password = 'my_password'; $violations = $validator->validate($password, [ new NotBlank(), new Length(array('min' => 6)), ]);In this example, the `Validation` class from the Symfony package is used to create a new validation instance. The password is then validated against the `NotBlank` and `Length` constraints to ensure it is not empty and is at least 6 characters long. The Validate factory is part of a package library called Laravel for the first example, and Symfony for the second example. Both packages provide a wide range of validation rules and constraints that can be used to validate a variety of input data types.