1

I'm working in Craft 2, and was wondering if there is a way to share the same file among all of my plugins? Each of the plugins will be reading the same XML file, and, currently, I've only been able to make it work by putting the same file in each plug-in's Resources folder, resulting in tedious duplication of those files and maintenance nightmares.
Would it be better to locate the file outside of the Craft folder?

Thanks

1 Answer 1

1

You could make a really simple Composer package that has just the XML file in it, and have both plugins require that composer package.

3
  • This XML file will be updated several times daily through a scheduled download... will there be issues in updating the XML file in the Composer package? I'm new to Composer - could you point me to a good place to start? Thanks!
    – buck1112
    Dec 28, 2023 at 8:20
  • Okay that's an important bit of information. If the XML file is going to be updated several times daily, why not just store the file in the cache? That way any plugin can get at it, and any time either plugin updates the cache entry, the other will see it. Jan 3 at 3:17
  • Thanks - Would it be the craft>storage>runtime>cache folder and just calls to that directory from my plugins?
    – buck1112
    Jan 5 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.