Common abstract class for plugins

I have a few plugins and intend to move them to a very common base with an abstract class.
The issue is that even if I apply solutions in order to avoid class duplications ( like EarnestoDev‘s answer for #31034 ) the system could end up with different versions of the abstract class if more of my plugins are present.

In order to avoid this I should update all my plugins when the abstract class is updated, but that seems to be an overkill.

Read More

Is there any other way to include classes only for a specific plugin rather than using namespaces?

Related posts

1 comment

  1. Unfortunately there is no system in WordPress to handle dependencies and sharing components between extensions is a challenge.

    The possible solutions roughly are:

    • make shared part a plugin and require each plugin to require it (and possibly auto install/activate)
    • implement loader that will take care of processing versioning for shared part and take care of loading latest version available (see scbFramework for one example of such)

    If extensions are for private use (as opposed to being separately and publicly available) you can manage them as part of whole site stack – in version control or Composer (which I hope will get more traction for WP projects).

Comments are closed.