In PHP namespace
and use
declarations are only valid in the physical file they appear in. These declarations do not span across require
s. They are already handled at compile-time.
If a.php
uses aliases in its namespace, and it is included by b.php
, the aliases defined in a.php
will not be seen by b.php
.
You will have to insert your use
statement into every file. Here's the documentation:
Importing rules are per file basis
However, you can work around this using class_alias:
class_alias('RedBean_Facade', 'R');