I'm learning how Composer is working (new to dev ^^) But i'm struggling to fix my autoloading...
here's my composer.json :
"autoload": {
"psr-4": {
"OCFram\\": "/../lib/",
"App\\": "/../",
"Model\\": "/../lib/vendors/",
"Entity\\": "/../lib/vendors/",
"FormBuilder\\": "/../lib/vendors/",
"Slug\\": "/../lib/vendors/"
}
},
So for example :
Fatal error: Uncaught Error: Class 'App\Frontend\FrontendApplication' not found
Well, FrontendApplication path (from composer.json) : **
../App/Frontend/FrontendApplication.php
Here's the FrontendApplication.php with the namespace :
<?php
namespace App\Frontend;
use \OCFram\Application;
class FrontendApplication extends Application
{
public function __construct()
{
parent::__construct();
$this->name = 'Frontend';
}
public function run()
{
$controller = $this->getController();
$controller->execute();
$this->httpResponse->setPage($controller->page());
$this->httpResponse->send();
}
}
Plus, i've , noticed this file (autoload_psr4.php) on vendor/composer :
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Slug\\' => array('/lib/vendors'),
'OCFram\\' => array('/lib'),
'Model\\' => array('/lib/vendors'),
'FormBuilder\\' => array('/lib/vendors'),
'Entity\\' => array('/lib/vendors'),
'App\\' => array('/'),
);
Would appreciate some help :)
[EDIT]
So i changed the path from "App\": "/../" (which was no sense) to : "App\": "../",
NOW after another composer dump-autoload i get this :
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Slug\\' => array($baseDir . '/../lib/vendors'),
'OCFram\\' => array($baseDir . '/../lib'),
'Model\\' => array($baseDir . '/../lib/vendors'),
'FormBuilder\\' => array($baseDir . '/../lib/vendors'),
'Entity\\' => array($baseDir . '/../lib/vendors'),
'App\\' => array($baseDir . '/..'),
);
But still same problem when i try php index.php i get : Fatal error: Uncaught Error: Class 'App\Frontend\FrontendApplication' not found