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

CC BY-SA 4.0
2023-12-28T08:20:50.803Z
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
CC BY-SA 4.0
2024-01-03T03:17:26.780Z
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.
andrew.welch
CC BY-SA 4.0
2024-01-05T15:58:22.983Z
Thanks -  Would it be the craft>storage>runtime>cache folder and just calls to that directory from my plugins?
buck1112
CC BY-SA 4.0
2023-12-15T23:38:43.053Z
2023-12-15T23:38:43.053Z
andrew.welch
<p>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.<br />
Would it be better to locate the file outside of the Craft folder?</p>
<p>Thanks</p>

<plugin-development><craft2>
Same File Shared By Multiple Plugins
# Same File Shared By Multiple Plugins

(Asked by: username_0 on 2023-12-15)

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

**Tags:** plugin-development, craft2


---

## 1 answers

### Answer by username_1 on 2023-12-15. Score: 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.

> **Comments:**
> **username_0**: 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!  
> **username_1**: 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.  
> **username_0**: Thanks -  Would it be the craft>storage>runtime>cache folder and just calls to that directory from my plugins?  

---

