Thursday, 12 September 2013

why my class can not be found?

why my class can not be found?

Doing some php and the root directory looks like this:
web/
-index.php
src/
-Controllers/
-IndexController.php
-Services/
-IpService.php
class IpService has namespace Service i added this namespace to autoload:
"autoload": {
"psr-0": {
"Service\\": "src/"
}
}
and in the IndexController.php im doing this:
use Services\IpService;
$app['ip_service'] = function () {
return new IpService();
};
but when i call $app['ip_service']->get() i'm getting the error:
Fatal error: Class 'Services\IpService' not found in
E:\xampp\htdocs\src\Controllers\IndexController.php on line 18

No comments:

Post a Comment