I am currently learning how to create WordPress plugins using my basic knowledge of OOP and am a bit stumped on how I can use a class from one plugin inside another. Both of my plugins have unique namespaces and the classes are being autoloaded with Composer.
I have attempted to insert the "use" keyword to import the specific namespace class but am unable to call the static functions inside of it directly.
//Plugin 1
namespace Test\PluginName1;
class Function {
public static function example() {
echo "test";
}
}
//Plugin 2
namespace Test\PluginName2;
use Test\PluginName1\Function;
class Test {
public static function frontend_output() {
$message = Function::example();
}
}
What would be the best way to include a class from another namespace?
Sorry if this seems simple but I can't work this one out.
Thank you.