I’m wondering where is the best place to store plugin data. In my case, the data is not associated with a frontend user page. It is only accessible via API calls. The plugin provides a custom panel view with some input, which needs to be stored somewhere. I thought of the following ways and would like to hear how some of you are handling this:
-
Plugin folder: I rejected this quite quickly as it’s not save when updating a plugin via git.
-
Plugin cache: Might work, but the data should actually be stored persistently. So flushing the cache would clear the plugin data, which is not good. So I rejected this idea, too.
-
Content folder: This is the way I’m going right now. I store the data in the content folder as the data really is some sort of content. However it isn’t page content. So I put the content in a folder with a leading dot in order not to have it confused with a regular page. The folder name is something like
.my-plugin
.
What do you think? Is this a good way to store plugin data? This approach works quite nicely in my Kirby installation without side effects. However, it appears a bit hacky to me. Do you have any other suggestions where to store plugin data that I didn’t think about?
Best regards,
Steffen