Hello all,
Recently I started to use the F3 framework and finding my way around quite easily, the only thing I can't seem to get to work is the autoloader. I simply get this error:
Class 'Connectors\Exact' not found [D:\wamp\www\exact\source\app\index.php:33]
Here is how I have setup everything.
Folder structure
D:\wamp\www\exact\vendor
This folder contains the Composer libraries including F3
D:\wamp\www\exact\source\app
This folder contains the .htaccess and index.php to get it all started.
D:\wamp\www\exact\source\app\connectors
D:\wamp\www\exact\source\app\connectors\Exact.php
D:\wamp\www\exact\source\app\connectors\Database.php
D:\wamp\www\exact\source\app\models
D:\wamp\www\exact\source\app\models\Customer.php
D:\wamp\www\exact\source\app\models\Order.php
These 2 folders contain the namespaced classes.
In the classes I have code like this:
namespace Connectors;
class Exact {
public function connect() {
}
}
In my index.php I have this:
require __DIR__ . '/../../vendor/autoload.php';
$f3 = \Base::instance();
$f3->set('AUTOLOAD', 'app/');
$f3->route('GET /order',
function() {
$connection = (new Connectors\Exact)->connect();
}
);
The routing works fine but it results in the error
Class 'Connectors\Exact' not found [D:\wamp\www\exact\source\app\index.php:33]
Now I wonder where my mistake is. Can you enlighten me?
Thank you.