如何在Laravel中使用标准的php包? 我尝试导入它但无法找到它?

I installed this Json Verification package:

https://github.com/justinrainbow/json-schema

It's just a PHP package it installs into vendor/justinrainbow/json-schema. It's composer.json is located here if look into it is needed: https://github.com/justinrainbow/json-schema/blob/master/composer.json

I need to access it in my Code so I tried this in my Controller:

use JsonSchema\Validator;

when I do this inside a method:

$validator = new JsonSchema\Validator;

I get this error:

 Symfony\Component\Debug\Exception\FatalThrowableError  : Class 'App\Commands\JsonSchema\Validator' not found

Package has been installed with composer and is in the vendor folder.

How do I access it so that I can run some code that it shows on its GitHub page:

$data = json_decode(file_get_contents('data.json'));

// Validate
$validator = new JsonSchema\Validator;
$validator->validate($data, (object)['$ref' => 'file://' . realpath('schema.json')]);

if ($validator->isValid()) {
    echo "The supplied JSON validates against the schema.
";
} else {
    echo "JSON does not validate. Violations:
";
    foreach ($validator->getErrors() as $error) {
        echo sprintf("[%s] %s
", $error['property'], $error['message']);
    }
}

Got it working by doing this:

use JsonSchema\Validator as JsonValidator;

and in the method:

$validator = new JsonValidator;