0

in my project I have imported by composer respect/validator. Now, I have a file (login.php) in a subfolder of subfolder where I need it. The Respect/Validation's documentation says write:

<?php use Respect\Validation\Validator as v;

obviously I must require my vendor/autoload.php (autogenerate Composer's file), I do it in index.php of my project in the root. Well, it work for every packages (Slim, twig...) but not for Respect/Validation, I try also with other package into my login.php but it's the same.

the error is: Fatal error: Class 'Respect\Validation\Validator' not found

so, i try also to require here the autoload.php and the results:

Warning: require_once(vendor/autoload.php): failed to open stream: No such file or directory

Fatal error: require_once(): Failed opening required 'vendor/autoload.php' (include_path='.;C:\xampp\php\PEAR')

I think that the problem is with autoload.php or with the path. Because I should not need the autoload in login.php or however when I require it, it should not change the error...

Matteo Calò
  • 361
  • 1
  • 2
  • 15
  • Have you set your `include_path` (using `set_include_path()`) so that your file can find `vendor/autoload.php` and that the autoloader can find the other classes? Do you need to register the autoloader after including `vendor/autoload.php` or is just including it enough? – Tomas Creemers Aug 18 '13 at 11:31
  • I including vendor/autoload.php in the root page of project. For example, for my package of Mongo DB it work correctly. Then, when I write only use Respect\Validation\Validator as v; it doesn't give me problems, it don't work when i try to operate with v o with the istance... I try now to use set_include_path() in my login.php but it desn't work! – Matteo Calò Aug 18 '13 at 11:53

0 Answers0