I have some custom classes used for a third party payment gateway that I need to integrate with my Yii2 advanced project. I have done a bunch of research but everyone seems to have a different way of doing this.
I would like to be able to reference these third party classes anywhere in my application with the "use namespace" directive. I added my classes to the path "/vendor/erec/moneris/". They all have a namespace of "erec\moneris". I added the alias in my config file like so…
'aliases' => [ '@erec\moneris' => '@vendor/erec/moneris', ],
When I try to include one of these classes with "use erec\moneris\ClassName;" directive I get the "class not found" exception.
If I change the namespace to "moneris" and set the alias like…
'aliases' => [ '@moneris' => '@vendor/erec/moneris', ],
it works. However, I want my namespace to be “erec\moneris” not just “moneris” because I will have other namespaces under the “erec” parent. My problem is that I can’t get the namespace inheritance to work. I’ve only been able to get a single namespace without the any “\” in it to work.
Does anyone know how I can achieve this?