I'm developing a business-to-business SaaS.
I expect that most of my customers will be able to use my mainline product, and I intend to deploy it in an independent instance for each customer. Some low-demand customers may be sharing a VPS node with other low-demand customers, others might have dedicated deployments, but the application will be designed such that it connects to a private database for each customer. It will not be multi-tenant.
Notably, I do anticipate that some customers will need customization -- perhaps integration with an internal or esoteric auth provider, or some other enterprise-style customizations.
I've designed many modularized and plugin hosting systems, and I think I'll be able to capture these customizations behind abstract interfaces. But deploying them in the way I'd like to here is a new challenge.
What's the best way to organize and deploy customer-specifc modules in single-tenant, composer-based, PHP project?
My current thought is to maintain a single mainline codebase for all customers. Each rare(?) customer that requires extra functionality would have that functionality captured inside of a private composer package, and integration would come down to:
- Have composer install the custom package during deployment
- Have a customer configuration spec that indicates which module(s) to use from the custom package during execution.
Step (2) is solved, as customer configuration is a necessary part of all installations and adding a few details that indicate which implementation to use for a given interface is a trivial addition.
It's step (1) that I'm not clear about. Presuming that I'm going in the right direction, is there an established/idiomatic way to load deployment-specific packages in composer? Would I just run a post-install step that modifies the base composer.json based on the customer configuration spec, adds the customer-specific packages, and runs an update?
If I'm not going in the right direction (and that's why I'm asking here and not on StackOverflow), what would you suggest as a better way to organize things?