I am trying to add a custom class to my Yii2 application, so I created a folder called "Payment" and inside this folder I created a class called Test.php, and the namespace is "payment"
<?php
namespace payment;
class Test{
public static function test(){
echo "Hello";
}
}
in my controller I add this
use payment;
and I am trying to access the method in the test class but I got class not found fatal error. what is wrong? Structure: + project-name-folder: -api -Payment -Test.php -modules - v1 - controllers - HelloController.php
paymentfolder?apiis in frontend, backend or common folder? Or none of these? If none, you may need to put inside of these then first.