I’m trying to include a JSON schema validator library but I’m having trouble getting it to work. The library is called Brainly, and you can find it here (first post, so I can’t embed links): github DOT com SLASH brainly SLASH jvalidator
I added it by putting the Brainly folder under protected/vendor. Then I added the name Brainly into my main.php, under the import section as so:
'import' => array(
'application.models.*',
'application.components.*',
'application.modules.auth.components.*',
'application.modules.auth.models.*',
'application.vendor.*',
'Money',
'Brainly',
'ext.yii-mail.YiiMailMessage'
),
And in my code I tried using it in these two ways:
$validator = new \Brainly\JValidator\Validator();
$validator = new Validator();
Unfortunately it still isn’t working well. I get a 500 server error returned with nothing being displayed, and the error is actually logged in the Apache error.log file, with the following message:
PHP Fatal error: Class 'Brainly\\JValidator\\Validator' not found in /var/www/protected/modules/api/components/APIHelper.php on line 155
I also took a look at the Extending Yii page which tells me to put it under a folder called vendors (notice the ‘s’ at the end, compared to the one I have which was created by the framework). I tried those steps as well and they didn’t work either.
Anyone have any ideas on what I might be doing wrong?