<p>What format is the source data in?  If it's already in a multidimensional PHP array, then it might be as simple as having a <code>data.php</code> file in your plugin and doing a <code>require_once</code> in your plugin's <code>init()</code> method and you're good to go.</p>

<p>Even if it's in a different format, loading it from <code>init()</code> and parsing it into the multidimensional array is a good option.</p>

CC BY-SA 3.0
2014-07-06T00:21:28.290Z
2014-07-06T00:21:28.290Z
Brad Bell
<p>I have static data that my plugin requires as an array (multidimensional with 100s of items), it doesn't need to change and it seems overkill to store in a database and not appropriate as just arrays in my code.</p>

<p>Options I have considered:</p>

<ul>
<li>Json files - load them in</li>
<li>In the config file</li>
</ul>

<p>Which is best and is there a more appropriate way to store access?</p>

<plugin-development>
What's the best place to store and load static data for plugins?
# What's the best place to store and load static data for plugins?

(Asked by: username_0 on 2014-07-05)

I have static data that my plugin requires as an array (multidimensional with 100s of items), it doesn't need to change and it seems overkill to store in a database and not appropriate as just arrays in my code.

Options I have considered:

* Json files - load them in
* In the config file

Which is best and is there a more appropriate way to store access?

**Tags:** plugin-development


---

## 1 answers

### Answer by username_1 on 2014-07-06. Score: 4

What format is the source data in? If it's already in a multidimensional PHP array, then it might be as simple as having a `data.php` file in your plugin and doing a `require_once` in your plugin's `init()` method and you're good to go.

Even if it's in a different format, loading it from `init()` and parsing it into the multidimensional array is a good option.


---

