impresspages / ImpressPages

ImpressPages is php framework with admin panel. Build functional website in one hour.
http://www.impresspages.org
Other
501 stars 178 forks source link

Shared assets and classes between plugins #758

Open TheFOBas opened 8 years ago

TheFOBas commented 8 years ago

I'm trying to create a couple of plugins that will share some assets and classes, but I wish to make them standalone. What is best way to make this happen? Where should I keep those classes and should I add them to different namespaces?

maskas commented 8 years ago

The namespace of each class must be the same as the folder that class appears in. Otherwise the class auto-loading won't work. You can always create a class from the other plugin using $x = new \Plugin\Xxx\Class(....);

you can also access assets of another plugin. Shouldn't be technically difficult except if you use it too much. That could be a sign of poor plugin decoupling.

TheFOBas commented 8 years ago

Yes I understand that but in my case there is no reason for user to have both of the plugins. For now the best idea that I have is to use third plugin as library.

maskas commented 8 years ago

Yes. That's an option. Or you can try to use git submodules too.

Mangirdas Skripka mangirdas@impresspages.org +37067128095

www.impresspages.org

Become our fan on Facebook http://www.facebook.com/ImpressPages and follow us on Twitter http://www.twitter.com/ImpressPages

On Fri, Sep 25, 2015 at 8:54 AM, Nerijus notifications@github.com wrote:

Yes I understand that but in my case there is no reason for user to have both of the plugins. For now the best idea that I have is to use third plugin as library.

— Reply to this email directly or view it on GitHub https://github.com/impresspages/ImpressPages/issues/758#issuecomment-143135205 .