I have the following namespace structure with the following class files
Application
|->App.php
|->Top
|->Start.php
|->Process.php
|->Child
|->Plugin.php
So in App.php I declared
namespace Application;
in the Startp.php ad
namespace Application\Top;
in the Plugin.php ad
namespace Application\Top\Child;
I see that I can call the Plugin.php class from App.php, for example
$object = new Top\Child\Plugin();
if it is a child / grandchild namespace, but what if I want to call Process.php from Plugin.php, which is the parent namespace from the branch? Is there something like a double dot ".." to indicate the top parent directory in the namespace? I'm trying to name something like
File: Plugin.php
$object = new ..\Process();
it didn’t work, it looks like I can only start from the root, like
$object = new \Application\Top\Process()
Is this the only option? Thanks!
source
share