Answer the question
In order to leave comments, you need to log in
Why can packages and their folders not be loaded in Laravel?
Part 1: I
had to create my own validation rules. I decided to do this through the class-successor ( here is the subtitle "Extending The Validator Class"). Accordingly, I created the /app/validators folder, put the class file there and added this folder to /composer.json. Next, I did artisan dump-autoload
and composer dump-autoload
. However, my file stubbornly did not load. I also added the folder to the ClassLoader::addDirectories array in the /app/start/global.php file, repeated the commands, but nothing was loaded yet.
After that, I called that file UserValidators.php, put it in /app/models, from where the files are definitely loaded, but my file stubbornly did not load.
Part 2:
I needed to add the TwitterOAuth library to my project. To do this, I decided to use packages, following every letter of this instruction , except for replacing the names and code of the library with my own. However, I was met with the same problem as with loading folders. Every time I try to do dump-autoload
, they tell me that my class was not found, that is, the file is stubbornly not loaded, although the system 100% sees some kind of package.
I'm already giving up, I've googled everything possible, tried everything, but it doesn't work. Has anyone encountered the same?
Update:
I poked around composer and found that my validators folder is included in the upload array, but it doesn't load at all...
Answer the question
In order to leave comments, you need to log in
In general, I created a ServiceProvider for my validator and it worked. I also began to use namespaces everywhere and Laravel very cheerfully picked up absolutely everything and everything is fine now.
Pack it in an archive and put it on some Yandex disk, it's interesting to see, I've never encountered such a problem. Maybe it's a matter of rights or ways.
And please write how you include the file in composer.json.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question