Laravel ClassLoader contains wrong / old file
in laravel 4 app a few weeks ago i created a workbench package:
/workbench/no-native/wizard
This package has a class named Handler
in the path /workbench/no-native/src/events/
, declared like this:
<?php
namespace Wizard\events;
class Handler{
....
To reset the autoload via composer, I added it:
"autoload": {
"classmap": [
"src/migrations",
"src/controllers",
"src/events",
],
"psr-0": {
"NoNative\\Wizard\\": "src/"
}
},
Ok, with this structure the package worked very well. Yesterday I had to move this package from workbench/no-native
to workbench/native
. The steps were as follows:
- Move directory
wizard
fromno-native
tonative
dir. - Update paths and namespaces.
- Update the package builder to target the new file structure.
-
Run the following commands (in
native
, new path):/home/user/public_html/my-app/workbench/native/wizard# composer update /home/user/public_html/my-app/workbench/native/wizard# composer dump-autoload
Upon completion, I noticed that on my localhost instance, the application works fine with changes, but on my real server, an exception is shown:
include (/home/user/public_html/my-app/workbench/no-native/wizard/src/events/Handler.php): failed to open stream: no file or directory: / home / user / public_html / my-app / vendor / composer / ClassLoader.php line 382
I am assuming the application is still trying to load the Handler class from the old path. Then I ran the commands to "clean" or "optimize" the application:
# php artisan optimize
# php artisan dump-autoload
And the exception still exists. The live server has the same code on my localhost instance because both work with cloned sources via Github. I don't know if I am missing anything else. My last option is to create a new package using the command and then create the classes again. But before doing that, I would like to ask you for alternatives.
Thanks in advance.
source to share