PHPackages                             joomla/registry - 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. [Framework](/categories/framework)
4. /
5. joomla/registry

ActiveJoomla-package[Framework](/categories/framework)

joomla/registry
===============

Joomla Registry Package

4.0.0(9mo ago)16468.6k—0.2%19[1 issues](https://github.com/joomla-framework/registry/issues)[1 PRs](https://github.com/joomla-framework/registry/pulls)20GPL-2.0-or-laterPHPPHP ^8.3.0CI passing

Since Jun 4Pushed 9mo ago15 watchersCompare

[ Source](https://github.com/joomla-framework/registry)[ Packagist](https://packagist.org/packages/joomla/registry)[ Docs](https://github.com/joomla-framework/registry)[ RSS](/packages/joomla-registry/feed)WikiDiscussions 3.x-dev Synced 1mo ago

READMEChangelog (5)Dependencies (6)Versions (41)Used By (20)

The Registry Package [![Build Status](https://github.com/joomla-framework/registry/actions/workflows/ci.yml/badge.svg?branch=3.x-dev)](https://github.com/joomla-framework/registry)
====================================================================================================================================================================================

[](#the-registry-package-)

[![Latest Stable Version](https://camo.githubusercontent.com/4a0be612351d2312a6111e9f0e73128aedd1335c5c807e84b60d1e2f37efb3f0/68747470733a2f2f706f7365722e707567782e6f72672f6a6f6f6d6c612f72656769737472792f762f737461626c65)](https://packagist.org/packages/joomla/registry)[![Total Downloads](https://camo.githubusercontent.com/9f8e5880477cc7e6fa26d19ff533c5c7d2e45fc086b2cd8ec800c77b9597daff/68747470733a2f2f706f7365722e707567782e6f72672f6a6f6f6d6c612f72656769737472792f646f776e6c6f616473)](https://packagist.org/packages/joomla/registry)[![Latest Unstable Version](https://camo.githubusercontent.com/e54b9ada68fdb96f79fa5e29fe2bab8c1391f8bed53be0d088a393e43230973b/68747470733a2f2f706f7365722e707567782e6f72672f6a6f6f6d6c612f72656769737472792f762f756e737461626c65)](https://packagist.org/packages/joomla/registry)[![License](https://camo.githubusercontent.com/dab55a544150f064095d53cce189beb8352a59c07e9e8ea8e7d0ea1612b10c0c/68747470733a2f2f706f7365722e707567782e6f72672f6a6f6f6d6c612f72656769737472792f6c6963656e7365)](https://packagist.org/packages/joomla/registry)

The Registry package provides an indexed key-value data store and an API for importing/exporting this data to several formats.

Load config by Registry
-----------------------

[](#load-config-by-registry)

```
use Joomla\Registry\Registry;

$registry = new Registry();

// Load by string
$registry->loadString('{"foo" : "bar"}');

$registry->loadString('', 'xml');

// Load by object or array
$registry->loadObject($object);
$registry->loadArray($array);

// Load by file
$registry->loadFile($root . '/config/config.json', 'json');
```

Accessing a Registry by getter &amp; setter
-------------------------------------------

[](#accessing-a-registry-by-getter--setter)

### Get value

[](#get-value)

```
$registry->get('foo');

// Get a non-exists value and return default
$registry->get('foo', 'default');

// OR

$registry->get('foo') ?: 'default';
```

### Set value

[](#set-value)

```
// Set value
$registry->set('bar', $value);

// Sets a default value if not already assigned.
$registry->def('bar', $default);
```

### Accessing children value by path

[](#accessing-children-value-by-path)

```
$json = '{
    "parent" : {
        "child" : "Foo"
    }
}';

$registry = new Registry($json);

$registry->get('parent.child'); // return 'Foo'

$registry->set('parent.child', $value);
```

Removing values from Registry
-----------------------------

[](#removing-values-from-registry)

```
// Set value
$registry->set('bar', $value);

// Remove the key
$registry->remove('bar');

// Works for nested keys too
$registry->set('nested.bar', $value);
$registry->remove('nested.bar');
```

Accessing a Registry as an Array
--------------------------------

[](#accessing-a-registry-as-an-array)

The `Registry` class implements `ArrayAccess` so the properties of the registry can be accessed as an array. Consider the following examples:

```
// Set a value in the registry.
$registry['foo'] = 'bar';

// Get a value from the registry;
$value = $registry['foo'];

// Check if a key in the registry is set.
if (isset($registry['foo']))
{
    echo 'Say bar.';
}
```

Merge Registry
--------------

[](#merge-registry)

#### Using load\* methods to merge two config files.

[](#using-load-methods-to-merge-two-config-files)

```
$json1 = '{
    "field" : {
        "keyA" : "valueA",
        "keyB" : "valueB"
    }
}';

$json2 = '{
    "field" : {
        "keyB" : "a new valueB"
    }
}';

$registry->loadString($json1);
$registry->loadString($json2);
```

Output

```
Array(
    field => Array(
        keyA => valueA
        keyB => a new valueB
    )
)

```

#### Merge another Registry

[](#merge-another-registry)

```
$object1 = '{
    "foo" : "foo value",
    "bar" : {
        "bar1" : "bar value 1",
        "bar2" : "bar value 2"
    }
}';

$object2 = '{
    "foo" : "foo value",
    "bar" : {
        "bar2" : "new bar value 2"
    }
}';

$registry1 = new Registry(json_decode($object1));
$registry2 = new Registry(json_decode($object2));

$registry1->merge($registry2);
```

If you just want to merge first level, do not hope recursive:

```
$registry1->merge($registry2, false); // Set param 2 to false that Registry will only merge first level
```

Dump to one dimension
---------------------

[](#dump-to-one-dimension)

```
$array = array(
    'flower' => array(
        'sunflower' => 'light',
        'sakura' => 'samurai'
    )
);

$registry = new Registry($array);

// Make data to one dimension

$flatted = $registry->flatten();

print_r($flatted);
```

The result:

```
Array
(
    [flower.sunflower] => light
    [flower.sakura] => samurai
)

```

Installation via Composer
-------------------------

[](#installation-via-composer)

Add `"joomla/registry": "~3.0"` to the 'require' block in your composer.json and then run `composer install`.

```
{
    "require": {
        "joomla/registry": "~3.0"
    }
}
```

Alternatively, you can simply run the following from the command line:

```
composer require joomla/registry "~3.0"
```

###  Health Score

61

—

FairBetter than 99% of packages

Maintenance54

Moderate activity, may be stable

Popularity48

Moderate usage in the ecosystem

Community40

Growing community involvement

Maturity90

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 56.8% 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 ~123 days

Recently: every ~218 days

Total

37

Last Release

299d ago

Major Versions

1.6.3 → 2.0.0-beta2020-06-05

1.6.4 → 2.0.22022-08-15

2.0.4 → 3.0.02023-10-08

3.0.2 → 4.0.02025-07-23

PHP version history (7 changes)1.0-alphaPHP &gt;=5.3.10

1.5.1PHP &gt;=5.3.10|&gt;=7.0

1.5.3PHP ^5.3.10|~7.0

2.0.0-betaPHP ^7.2.5

2.0.2PHP ^7.2.5|~8.0.0|~8.1.0

3.0.0PHP ^8.1.0

4.0.0PHP ^8.3.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/305a2164440014dcef9ac681c139fe5e8a1ce1d7a8c3b3cfb828497729a4c70e?d=identicon)[wilsonge](/maintainers/wilsonge)

---

Top Contributors

[![mbabker](https://avatars.githubusercontent.com/u/368545?v=4)](https://github.com/mbabker "mbabker (193 commits)")[![Hackwar](https://avatars.githubusercontent.com/u/313866?v=4)](https://github.com/Hackwar "Hackwar (23 commits)")[![dongilbert](https://avatars.githubusercontent.com/u/718028?v=4)](https://github.com/dongilbert "dongilbert (20 commits)")[![wilsonge](https://avatars.githubusercontent.com/u/1986000?v=4)](https://github.com/wilsonge "wilsonge (18 commits)")[![Fedik](https://avatars.githubusercontent.com/u/1568198?v=4)](https://github.com/Fedik "Fedik (13 commits)")[![asika32764](https://avatars.githubusercontent.com/u/1639206?v=4)](https://github.com/asika32764 "asika32764 (12 commits)")[![frankmayer](https://avatars.githubusercontent.com/u/825497?v=4)](https://github.com/frankmayer "frankmayer (11 commits)")[![nibra](https://avatars.githubusercontent.com/u/827605?v=4)](https://github.com/nibra "nibra (8 commits)")[![ianmacl](https://avatars.githubusercontent.com/u/176534?v=4)](https://github.com/ianmacl "ianmacl (5 commits)")[![eddieajau](https://avatars.githubusercontent.com/u/700871?v=4)](https://github.com/eddieajau "eddieajau (4 commits)")[![okonomiyaki3000](https://avatars.githubusercontent.com/u/79470?v=4)](https://github.com/okonomiyaki3000 "okonomiyaki3000 (4 commits)")[![joomla-jenkins](https://avatars.githubusercontent.com/u/929228?v=4)](https://github.com/joomla-jenkins "joomla-jenkins (3 commits)")[![zero-24](https://avatars.githubusercontent.com/u/2596554?v=4)](https://github.com/zero-24 "zero-24 (2 commits)")[![brianteeman](https://avatars.githubusercontent.com/u/1296369?v=4)](https://github.com/brianteeman "brianteeman (2 commits)")[![demis-palma](https://avatars.githubusercontent.com/u/1609992?v=4)](https://github.com/demis-palma "demis-palma (2 commits)")[![heelc29](https://avatars.githubusercontent.com/u/66922325?v=4)](https://github.com/heelc29 "heelc29 (2 commits)")[![HLeithner](https://avatars.githubusercontent.com/u/1497730?v=4)](https://github.com/HLeithner "HLeithner (2 commits)")[![realityking](https://avatars.githubusercontent.com/u/628508?v=4)](https://github.com/realityking "realityking (2 commits)")[![richard67](https://avatars.githubusercontent.com/u/7413183?v=4)](https://github.com/richard67 "richard67 (2 commits)")[![SharkyKZ](https://avatars.githubusercontent.com/u/7325021?v=4)](https://github.com/SharkyKZ "SharkyKZ (2 commits)")

---

Tags

joomlajoomla-frameworkkey-valuephpregistryframeworkjoomlaregistry

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/joomla-registry/health.svg)

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

###  Alternatives

[joomla/filter

Joomla Filter Package

151.4M8](/packages/joomla-filter)[joomla/application

Joomla Application Package

23404.8k11](/packages/joomla-application)[joomla/http

Joomla HTTP Package

17674.4k12](/packages/joomla-http)[joomla/di

Joomla DI Package

15391.2k11](/packages/joomla-di)[joomla/filesystem

Joomla Filesystem Package

12369.7k7](/packages/joomla-filesystem)[joomla/github

Joomla Github Package

2863.3k2](/packages/joomla-github)

PHPackages © 2026

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