PHPackages                             liip/drupalregistrymodule - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. liip/drupalregistrymodule

ActiveDrupal-module[API Development](/categories/api)

liip/drupalregistrymodule
=========================

This module provides an API to by used to persist/cache information.

v2.0.2(12y ago)31.4k2[1 issues](https://github.com/liip/LiipDrupalRegistryModule/issues)[4 PRs](https://github.com/liip/LiipDrupalRegistryModule/pulls)2MITPHPPHP &gt;=5.3.8,&lt;5.4

Since May 7Pushed 11y ago58 watchersCompare

[ Source](https://github.com/liip/LiipDrupalRegistryModule)[ Packagist](https://packagist.org/packages/liip/drupalregistrymodule)[ RSS](/packages/liip-drupalregistrymodule/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (10)Used By (2)

Liip Drupal Registry Module
===========================

[](#liip-drupal-registry-module)

This module provides an API to store key/value pairs of information. The Idea came when we had to change the persistence layer of how custom data is stored to be available to the system later. We started with the [standard Drupal 7 way](http://api.drupal.org/api/drupal/includes!bootstrap.inc/function/variable_set/7) to cache data by implementing a facade to the `variable_get()`, `variable_set()`, `variable_del()` functions. This implementation is provided as the default and example implementation for the registry.

Restrictions
------------

[](#restrictions)

It is not possible to store other objects than value objects without private members. Keep in mind that objects of any instance will be converted to instances of stdClass.

Current Travis Status
---------------------

[](#current-travis-status)

[![Build Status](https://camo.githubusercontent.com/5aabebc566082783386a996fd2091681664f1c02c6aafed53daa600fc9c564b0/68747470733a2f2f7472617669732d63692e6f72672f6c6969702f4c69697044727570616c52656769737472794d6f64756c652e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/liip/LiipDrupalRegistryModule)

Installation
------------

[](#installation)

The source is now PSR-0 compatible. There is no specific installation routine to be followed. Just clone or checkout the source into to your project and use it. In case you don't use a [PSR-0](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md) compatible autoloader, you only have to add the `bootstrap.php` into your bootstrap or autoloader.

### Composer

[](#composer)

Add the following lines to your `composer.json` file and update your project's composer installation.

```
{
    "require": {
       "liip/drupalregistrymodule": "dev-master"
    }
}
```

This composer configuration will checkout the 'cutting eadge' version ('dev-master') of the project. Be alarmed that this might be broken sometimes.

**NOTE:**In case you do not know what this means the [composer project website](http://getcomposer.org) is a good place to start.

### Github

[](#github)

Thus I recommend the composer way to make LiipDrupalRegistryModule a dependency to your project. The sources are also available via github. Just clone it as you might be familiar with.

```
$ git clone git@github.com:liip/LiipDrupalRegistryModule.git
```

Dependencies
------------

[](#dependencies)

- LiipDrupalConnector ()
- Assert ()

### Optional

[](#optional)

- Elastica ()

Usage
-----

[](#usage)

A good place to find examples of how this library works is always the Tests folder. For those not familiar with PHPUnit a short intro:

```
$assertions = new \Assert\Assertion();

$registry = new D7Config('myEvents', $assertions);

// put stuff in to the registry.
$registry->register('eventItemRegister', $item);

// get as single element out of the registry or an empty array if it does not exist.
$item = $registry->getContentById('eventItemRegister', array());

// get complete register
$items = $register->getContent();

// replace content of an item with a new value
$register->replace('eventItemRegister', $newItem);

// determine if an element is already registered
$inRegister = $register->isRegistered('eventItemRegister');

// get rid of a single element
$registry->unregister('eventItemRegister');

// destroy the complete registry
$registry->destroy();
```

### Dispatching registry actions

[](#dispatching-registry-actions)

It turned out there is a need to multiply an action to a number of registries. In our case we needed to store data to an ElasticSearch custer and - for backup reasons - to a MySql database. To achieve this the dispatcher was introduced.

Providing a container to attach registries the dispatcher invokes the requested action on every registered registry. Example:

```
$assertions = new \Assert\Assertion();
$indexName = 'myEvents';
$connection = new \PDO('mysql:host=localhost;dbname=testdb');

$drupalRegistry = new D7Config($indexName, $assertions);
$esRegistry = new Elasticsearch($indexName, $assertion, new NoOpDecorator());
$dbRegistry = new MySql($indexName, $assertion, $connection);

$dispatcher = new Dispatcher();
$dispatcher->attach($drupalRegistry, 'd7');
$dispatcher->attach($esRegistry, 'es');
$dispatcher->attach($dbRegistry, 'db');

$output = $dispatcher->dispatch('register', 'myDocumentId', array({some content}));

if ($dispatcher->hasError()) {

    throw new RegistryException($dispatcher->getLastErrorMessages());
}
```

Supported Systems
-----------------

[](#supported-systems)

- D7 configuration array (facade to variable\_get(), variable\_set(), variable\_del())
- Elasticsearch (based on the elastica library)
- Memory
- MySql

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community27

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 83.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~131 days

Recently: every ~145 days

Total

6

Last Release

4146d ago

Major Versions

v1.0.1 → v2.0.02013-07-30

PHP version history (2 changes)v1.0.0PHP &gt;=5.3.8,&lt;5.4

1.4.0.x-devPHP &gt;=5.3.8

### Community

Maintainers

![](https://www.gravatar.com/avatar/ce9845fe6fb3492df8bd632b865d4ff303051cf68e28282f34bf5cc3372d9150?d=identicon)[lapistano](/maintainers/lapistano)

![](https://www.gravatar.com/avatar/e04d485c2445123bbe8f625a73f21b6b8f66b83c6612b40b4e3953b9f404d0a6?d=identicon)[pjezek](/maintainers/pjezek)

![](https://www.gravatar.com/avatar/213d29d5708408719ffd6bf637e1aef6f7933a28c57ef694e7178eccdc67cefe?d=identicon)[samkoch](/maintainers/samkoch)

---

Top Contributors

[![lapistano](https://avatars.githubusercontent.com/u/95115?v=4)](https://github.com/lapistano "lapistano (133 commits)")[![pjezek](https://avatars.githubusercontent.com/u/147792?v=4)](https://github.com/pjezek "pjezek (20 commits)")[![adri](https://avatars.githubusercontent.com/u/133832?v=4)](https://github.com/adri "adri (3 commits)")[![matteodem](https://avatars.githubusercontent.com/u/1301147?v=4)](https://github.com/matteodem "matteodem (2 commits)")[![benoitMariaux](https://avatars.githubusercontent.com/u/716856?v=4)](https://github.com/benoitMariaux "benoitMariaux (1 commits)")[![lsmith77](https://avatars.githubusercontent.com/u/300279?v=4)](https://github.com/lsmith77 "lsmith77 (1 commits)")

---

Tags

apielasticsearchdrupalregistryDrupal 7loose couplingoodsoftware quality

### Embed Badge

![Health badge](/badges/liip-drupalregistrymodule/health.svg)

```
[![Health](https://phpackages.com/badges/liip-drupalregistrymodule/health.svg)](https://phpackages.com/packages/liip-drupalregistrymodule)
```

###  Alternatives

[liip/drupalconnectormodule

The DrupalConnector Module is an abstraction layer to the Drupal 7 API of global functions in order to use them in an OOD setup.

121.7k3](/packages/liip-drupalconnectormodule)[madkom/docker-registry-api

Client for docker registry.

149.2k](/packages/madkom-docker-registry-api)[hussainweb/drupal-api-client

Convenient wrapper on Guzzle to access Drupal.org API

148.8k](/packages/hussainweb-drupal-api-client)[mikemadisonweb/yii2-elasticsearch

Yii2 extension for integration with Elasticsearch version 5.0 and above.

164.1k](/packages/mikemadisonweb-yii2-elasticsearch)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
