I'm trying to use symfony flex with a bundle.
I have this directory structure
/
src/
AppBundle/
AppBundle.php
# Many classes
Kernel.php
I want to load Kernel.php class with this namespace App
and classes inside AppBundle with the namespace AppBundle
.
I've tried many composer configurations but I couldn't load them.
"psr-4": {
"AppBundle\\": "src/AppBundle/",
"App\\": "src/"
}
But I got errors like this:
Expected to find class "App\AppBundle\AppBundle" in file "/var/www/vhosts/flex/src/AppBundle/AppBundle.php"
UPDATE
src/Kernel.php class have a different namespace and I couldn't change it because other classes used it, the namespace is App
. Some scripts call that class using use App\Kernel
src/AppBundle/AppBundle.php
class has this namespace AppBundle
There is way to do this?
UPDATE 2
I sorted it out:
"autoload": {
"psr-4": {
"AppBundle\\": "src/AppBundle/"
},
"classmap": [
{ "App\\Kernel": "src/Kernel.php" }
]
},