@mnapoli opened this Issue on November 11th 2014 Member

Currently plugins are expected to by in the Piwik\Plugin namespace.

This is not really ideal as it defeats the purpose of namespaces:

  • risk of clashes/conflicts between different vendors releasing a similar plugin
  • no separation of code between vendors/projects

It would be better if, for example, Piwik PRO plugins were in a PiwikPro namespace (or similar).

Do you agree with this? And if so, how can we do it?

It seems related to the constraint that plugins must be in the plugins/ directory, and the whole "install plugins with Composer" topic.

@diosmosis commented on November 11th 2014 Member

There's a lot (or maybe just some) code that depends on plugins being in Piwik\Plugins. For example, the name of a plugin is obtained from the namespace by looking for Piwik\Plugins{Name}. Maybe DI can be used (ie, Plugin objects are added to DI, and these objects are used to determine all needed info). So we don't have to care about what namespace or folder they're in?

@mnapoli commented on November 12th 2014 Member

Maybe DI can be used (ie, Plugin objects are added to DI, and these objects are used to determine all needed info).

Ideally yes! In the config there's a list of installed plugins. I guess that means that we can use it for finding plugins instead of relying on the naming. Then later we might move that list into the DI configuration.

@diosmosis commented on November 12th 2014 Member

Ok, for the 'get plugin name from namespace' issue, we could do something like:

foreach ($pluginsLoadedAndActivated as $plugin) {
    if ($plugin->getNamespace() == $namespaceWereLookingFor) {
        return $plugin;
    }
}

Not sure what other parts of Piwik depend on the plugin namespace.

@mattab commented on November 12th 2014 Owner

I'm not sure there are enough benefits for the cost involved of changing it. Moving to mid term. let me know if you disagree and think this is more important

This Issue was closed on May 6th 2016
Powered by GitHub Issue Mirror