I work as a Website developer. We use a framework for building the backend of our sites. This framework recently released a new major version with lots of breaking changes. We have some sites using the old and many sites using the new major version.
I am currently tasked with writing a module that needs to work with both framework versions. This module needs to talk to an external API that we are maintaining, so if we change/update that API we need to update both modules. Since both versions of the framework are fairly different we need separate code bases to maintain the module.
My question is: How should I version the module to prepare for future major releases of the API while also keeping both framework versions separate Ideally while sharing code
What I have thought of:
- Use different package names:
module-v1
and for the newer usemodule-v2
- Use a fourth version number
1|2.MAJOR.MINOR.PATCH
where the first digit is the framework version (don't know if composer supports this) - Use different branches (
release/1
,release/2
)
Note: Specifically, we are using PHP and composer for managing packages.