Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Composer doesn't find file set up on "files" autoloading mechanism of composer.json

I have a Laravel project that I cloned from Bitbucket. Why is this happening? Why doesn’t Composer find the file Helper.php in the folder although it is there? I have already read many similar problems, but none of the solutions worked for me.

composer.json

"autoload": {
    "psr-4": {
        "App\\": "app/",
        "Database\\Factories\\": "database/factories/",
        "Database\\Seeders\\": "database/seeders/"
    },
    "files": [
        "App/Helpers/Helper.php"
    ]
},

I have the following folder structure inside the project: app > Helpers > Helper.php. But for some reason, when I run composer install, I get an error as follows at the end of execution.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Illuminate\Foundation\ComposerScripts::postAutoloadDump Script
Illuminate\Foundation\ComposerScripts::postAutoloadDump handling the
post-autoload-dump event terminated with an exception
[ErrorException]
require(/var/www/html/acessoportal/vendor/composer/../../App/Helpers/Helper.php):
Failed to open stream: No such file or directory

>Solution :

Change App in the file path to lower case version app:

...
"files": [
    "app/Helpers/Helper.php"
    ]
...
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading