WikiaRegistry provides convinient, abstract way of storing shared data. It behaves as hash map allowing storage, retrieval, removal and testing of key => value data while abstracting data storage. In Wikia it's being used to abstract global variables access (WikiaGlobalsRegistry) and application/extensions specific data (WikiaLocalRegistry).

Object oriented data access

Storing data with WikiaRegistry is simple. Just create an instance of concrete WikiaRegistry class and call it's set method:

$registry = new WikiaLocalRegistry();
$registry->set('myKey', 'myData');

Later on data can be retrieved using has() and get() methods:

if ($registry->has('myKey')) {
    echo $registry->get('myKey');

No longer needed data can be removed from registry using remove() method:


Array access

WikiaRegistry implements ArrayAccess interface, thus it can be used as array too:

$registry = new WikiaLocalRegistry();
$registry['myKey'] = 'myData';

if (isset($registry['myKey']) {
    echo $registry['myKey'];


Real advantage over using plain arrays or global variables is ability to simulate registry (mock it). When testing one can force registry to return some specific data, for instance Memcache mock instead of real Memcache object.