I have a project structure:
In the index.php I create 2 new objects:
use App\Controllers\Test;
use Xuborx\Cms\App;
new Test();
new App();
My Test.php
<?php
namespace App\Controllers;
class Test
{
}
My App.php
<?php
namespace Xuborx\Cms;
class App {
}
My autoload object in composer.json:
"autoload": {
"psr-4": {
"App\\Controllers\\": "app/controllers",
"Xuborx\\Cms\\": "vendor/xuborx/cms"
}
}
Object Test created successfully in the index.php, but when I am creating new App, I have an error:
Fatal error: Uncaught Error: Class 'Xuborx\Cms\App' not found in /home/denis/Coding/xuborx-cms/public/index.php:8 Stack trace: #0 {main} thrown in /home/denis/Coding/xuborx-cms/public/index.php on line 8
Also, when I run composer dump-autoload -o, I get error:
Class Xuborx\Cms\App located in ./vendor/xuborx/cms/core/App.php does not comply with psr-4 autoloading standard. Skipping.
I think, I not correct use autoload in composer.json, but I don't understand my error. Please< talk me about it.
App.php are inside /core directory :
autoload": {
"psr-4": {
"App\\Controllers\\": "app/controllers",
"Xuborx\\Cms\\": "vendor/xuborx/cms/core"
}
}