Register all sub namespace in Phalcon

110 Views Asked by At

I am new to Phalcon. The document states we can register namespace as follow

$loader->registerNamespaces(
[
   'Example\Base'    => 'vendor/example/base',
   'Example\Adapter' => 'vendor/example/adapter',
   'Example'         => 'vendor/example',
]);

It needs to register every sub namespaces under Example. But I saw here Izo states that with suitable folder structure and namespace prefix, we only need to specific the root namespace like this

$loader->registerNamespaces([
  'Example'         => 'vendor/example'
])

Izo gave an example: say you have a folder directory /var/www/myapp/Plugins/, if you have file : /var/www/myapp/Plugins/Auth/Users.php, this file has to be with namespace MYAPP\Plugins\Auth and class name has to be Users

I cannot find any document talking about it, can anyone helps?

0

There are 0 best solutions below