XF 2.3 Add-on versions for breaking XF changes

stromb0li

Well-known member
What is the best practice for releasing add-ons that have a breaking change between XF 2.2 and 2.3?

Should I release a new add-on with the same name or should I have a single add-on and identify the version of XF and have logic specific to each version? If I should have a single add-on version and identify the board version, what's the easiest way to obtain the board version?

If I should have a single add-on but determine version specific code, should I do something like this?
PHP:
if (\XF::$versionId >2030000){
    //xf 2.3 code
}else{
    //xf 2.2 code
}
 
Last edited:
You can release a new version but constrain the requirements to XF 2.3 in your addon.json:

JSON:
"require": {
    "XF": [
        2030000,
        "XenForo 2.3.0+"
    ]
}

Supporting multiple versions in a single release is not part of our development considerations, but usually technically achievable. For simpler changes, you can either maintain separate branches, or switch on \XF::$versionId as you said.
 
If I can do a release that supports multiple versions, I will - but sometimes it's not technically possible.

If it's not possible to support multiple versions in the one addon, you then need to decide whether you want to continue maintaining the old version or not. If you don't, then just release a new version with the appropriate constraints as mentioned by Jeremy.

For my SparkPost addon - given it's a complete rewrite to change from Swiftmailer to Symfony Mailer - I decided to release it as a separate addon. I didn't need to do it that way, it was just a decision I made. I do have multiple sites still running on XF 2.2, so I'll need to continue supporting the 2.2 version of the addon for a while - which will require a separate release from the XF 2.3 version if patches are required.

For all of my other XF 2.3 compatible addons so far, I've been able to release a version that works for both XF 2.2 and 2.3 using conditional logic where required.
 
Back
Top Bottom