Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

geebengs's avatar

ReflectionException: Class validator does not exist

use Illuminate\Support\Facades\Validator;

/**
 * Validate the tenant's credentials
 *
 * @param array $data
 * @return bool
 */
public function validate(array $data)
{
    $data = array_only($data, ['email', 'href']);

    $validator = Validator::make($data, $this->rules);

    if ($validator->passes()) return true;

    $this->errors = $validator->messages();

    return false;
}

my config/app.php has this following defined under the aliases array:

'Validator' => Illuminate\Support\Facades\Validator::class,

It also has the following defined under the providers array:

Illuminate\Validation\ValidationServiceProvider::class,

whenever I try to import the Validator facade using only the following:

use Validator

I get the following error:

Fatal error: Call to undefined method Illuminate\Support\Facades\Validator::make() in ....

I have done composer dump-autoload, I have deleted the vendors folder and done composer update.

Any help would be appreciated.

Thanks.

0 likes
1 reply
bheath's avatar

I don't think that's the proper namespace.

Try use Validator;

Please or to participate in this conversation.