Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

[Solved] Performance

Just curious, will have more than 10 Modules affect performance on the app?

I'm currently having a debate on whether to load modules and take care of loading namespace there or loading via global namespace.

Via modules:

<?php
$app->registerModules([
    'foo' => [...],
    'bar' => [...],
    'baz' => [...],
    'qux' => [...],
]);

Via namespace:

<?php
$loader->registerNamespaces([
    'App\Controller' => '/path/to/app/controller/',
    'App\Model'      => '/path/to/app/model/',
    'Foo\Controller' => '/path/to/foo/controller/',
    'Foo\Model'      => '/path/to/foo/model/',
    'Bar\Controller' => '/path/to/bar/controller/',
    'Bar\Model'      => '/path/to/bar/controller/',
    '....'           => '/you/get/the/point/'
]);

What do you say ?



7.3k
Accepted
answer
edited Mar '14

If you have structure like :

Acme
|______Foo (module)
|______Bar (module)
....
|______Any (module)

you can use one global namespace

$loader->registerNamespaces([
    'Acme' => '/path/to/Acme/'
]);

Phalcon support PSR-0

Well, that was embarrassing! Thank you Oleg.