My application isn’t for my own site, it’s an open source app for others to use. As such, there are a lot of optional features that may or may not be enabled, or where you pick one of a few options.
Online payment provider is what I’m currently looking at, but it’s not the only example. I have two providers supported at the moment, and a third one in progress. To date, I’ve just had a drop-down to select which one to use, and a class for each one, with a consistent interface to work through. That has been okay, but I’m finding it in terms of how the third one wants to work.
I’m thinking that I should move these into plugins, where they’d have a little more freedom to do what they need to do. But if I’m doing that, what I’d like is a structure where I don’t have to change anything about existing code when a new plugin is added, the system would somehow be able to recognize that it’s there, know what type it is, and add it to the list of options in the appropriate place. And ideally, it would be able to somehow handle third-party plugins dropped into the
vendor folder via
composer or whatever.
I’m not anticipating any problem with implementing whatever structure I come up with, but very much unsure about what that structure should be. Maybe I need a
plugins table that has a manually-created record for each one (perhaps automatically created by migrations in the plugins themselves; just using manual as an alternative to, for example, scanning the file system).
So, if you’ve got any good ideas for me along these lines, pointers to where others have done this sort of thing, anything like that, I’m happy to entertain any possibility.