Namespace problems with helper classes


i have to include some hlper classes to my application. so i generated directory classes in my backend-folder to put there my helpers.


namespace backend\classes;

class foo()


In the controller i have the following:


namespace backend\controllers;

use backend\classes\foo;

use yii\web\Controller;

class myController extends Controller




           $f = new foo();



Unable to find ‘backend\classes\foo’ in file: /var/www/actportal/backend/classes/foo.php. Namespace missing?

I searched around but i can’t find a solution. I hope here will be somebody help me.



Does the file exist /var/www/actportal/backend/classes/foo.php in this path?

You should also start your class names with an upper case letter. Also the file name of course.

And maybe you should start your namespace with for class foo with ‘yii’ if it is part of your application.

But you see, I’m also not quite sure what I’m talking about. But maybe it helps you ;)

i have solved the problem.

instead of <? i now use <?php and all works fine.