PHPackages                             professional-wiki/wikibase-automated-values - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. professional-wiki/wikibase-automated-values

ActiveMediawiki-extension[Utility &amp; Helpers](/categories/utility)

professional-wiki/wikibase-automated-values
===========================================

Automatic creation of Wikibase labels and aliases based on statement values

1.1.0(1y ago)69.6k↑50%3[7 issues](https://github.com/ProfessionalWiki/AutomatedValues/issues)[1 PRs](https://github.com/ProfessionalWiki/AutomatedValues/pulls)GPL-2.0-or-laterPHPPHP &gt;=7.4CI failing

Since Apr 29Pushed 1mo ago9 watchersCompare

[ Source](https://github.com/ProfessionalWiki/AutomatedValues)[ Packagist](https://packagist.org/packages/professional-wiki/wikibase-automated-values)[ Docs](https://github.com/ProfessionalWiki/AutomatedValues)[ GitHub Sponsors](https://github.com/JeroenDeDauw)[ RSS](/packages/professional-wiki-wikibase-automated-values/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (4)Used By (0)

Automated Values
================

[](#automated-values)

[![GitHub Workflow Status](https://camo.githubusercontent.com/fbd324ddc464f4c85868b988ab1844d6ce99e792201fd1ae1a394dec16a9d655/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f50726f66657373696f6e616c57696b692f4175746f6d6174656456616c7565732f63692e796d6c3f6272616e63683d6d6173746572)](https://github.com/ProfessionalWiki/AutomatedValues/actions?query=workflow%3ACI)[![codecov](https://camo.githubusercontent.com/1f0ebc22819f9dd3dcb52dc1f52172d82a99bf355b98962d1659a57bd0022b73/68747470733a2f2f636f6465636f762e696f2f67682f50726f66657373696f6e616c57696b692f4175746f6d6174656456616c7565732f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d476e4f4733464631365a)](https://codecov.io/gh/ProfessionalWiki/AutomatedValues)[![Type Coverage](https://camo.githubusercontent.com/33580530ae86255917d0859ed223ade304e82581af24fafca7c011c78efe7226/68747470733a2f2f73686570686572642e6465762f6769746875622f50726f66657373696f6e616c57696b692f4175746f6d6174656456616c7565732f636f7665726167652e737667)](https://shepherd.dev/github/ProfessionalWiki/AutomatedValues)[![Psalm level](https://camo.githubusercontent.com/9ee9f87b75b51870810409dffc7fb33c7c0659fe69dbfb4d18224bb741657374/68747470733a2f2f73686570686572642e6465762f6769746875622f50726f66657373696f6e616c57696b692f4175746f6d6174656456616c7565732f6c6576656c2e737667)](psalm.xml)[![Latest Stable Version](https://camo.githubusercontent.com/634e1d5f3c2b4657b5de5d84c620cd1f5224f5ba69a208b00e206dedc4a4a656/68747470733a2f2f706f7365722e707567782e6f72672f70726f66657373696f6e616c2d77696b692f77696b69626173652d6175746f6d617465642d76616c7565732f762f737461626c65)](https://packagist.org/packages/professional-wiki/wikibase-automated-values)[![Download count](https://camo.githubusercontent.com/cadddffe69489c035eb39a1e8ba3ee7ba0171ec12999604c5742f3852d037089/68747470733a2f2f706f7365722e707567782e6f72672f70726f66657373696f6e616c2d77696b692f77696b69626173652d6175746f6d617465642d76616c7565732f646f776e6c6f616473)](https://packagist.org/packages/professional-wiki/wikibase-automated-values)[![License](https://camo.githubusercontent.com/32b41a52270ba20318cea14af44633dc3bfce3762da87389fca906add750a69d/68747470733a2f2f706f7365722e707567782e6f72672f70726f66657373696f6e616c2d77696b692f77696b69626173652d6175746f6d617465642d76616c7565732f6c6963656e7365)](LICENSE)

[Wikibase](https://wikibase.consulting/what-is-wikibase/) extension that allows defining rules to automatically set labels or aliases based on Statement values.

[Professional Wiki](https://professional.wiki) created and maintains Automated Values. We provide [Wikibase hosting](https://professional.wiki/en/hosting/wikibase), [Wikibase development](https://professional.wiki/en/wikibase-software-development), and [Wikibase consulting](https://wikibase.consulting/).

Automated Values was created for the Luxembourg Ministry of Culture, which funded initial development.

You can find a demo of this extension at

**Table of Contents**

- [Usage](#usage)
- [Installation](#installation)
- [PHP Configuration](#php-configuration)
- [Development](#development)
- [Release notes](#release-notes)

Usage
-----

[](#usage)

[![](.github/youtube.png "Play video")](https://www.youtube.com/watch?v=BO58wulCFVU)

The core building block of this extension are so-called "Rules".

You can read the below step-by-step explanation or look immediately at [example.json](https://github.com/ProfessionalWiki/AutomatedValues/blob/master/example.json).

A Rule consists of zero or more Entity Criteria, which allow you to specify which Wikibase entities the Rule applies to. For instance, "all entities where P1 is Q1", which might translate to "all entities instanceof Person".

```
{
	"when": [
		{
			"statement": "P1",
			"equalTo": "Q1"
		}
	]
}
```

A rule can also have zero or more Build Specifications. These describe how to automatically build values on matching Entities, and which languages to update. They are available both for Labels and Aliases.

```
{
	"buildLabel": {
		"en": {
			"P2": "$"
		}
	},
	"buildAliases": {
		"*": {
			"P5.P3": "President ",
			"P5": "$",
			"P5.P4": ", $"
		}
	}
}
```

Rules can be defined on page `MediaWiki:AutomatedValues`. Alternatively, they can be defined in LocalSettings.php, see the [PHP Configuration](#php-configuration) section.

To define rules for your wiki, head to `MediaWiki:AutomatedValues` and create the page. This page only accepts JSON that adheres to the [JSON Schema](https://github.com/ProfessionalWiki/AutomatedValues/blob/master/schema.json). The page will refuse to save your changes if you enter invalid JSON.

Editing of pages in the `MediaWiki` namespace, which includes `MediaWiki:AutomatedValues`, is likely restricted to users with elevated permissions. By default, MediaWiki restricts editing in this namespace to people with the `editinterface` right. For more information, go to the page `Special:ListGroupRights#Namespace_restrictions` on your wiki.

You can find a complete and valid example of a list of Rules, that could be placed on `MediaWiki:AutomatedValues`, at [example.json](https://github.com/ProfessionalWiki/AutomatedValues/blob/master/example.json).

### Supported Entity Criteria

[](#supported-entity-criteria)

Currently, it is only possible to check equality of statement main values, and only for Properties of type String or EntityId.

A Rule can contain multiple Entity Criteria, in which case they all need to match for the Rule to be applied. A Rule can also contain no Entity Criteria, in which case it will be applied to all Entities.

### Build Specifications

[](#build-specifications)

Build Specifications are essentially templates that describe how to build the values.

You can have different Build Specifications for different languages:

```
{
	"buildLabel": {
		"en": {
			"P2": "$"
		},
		"de": {
			"P3": "$"
		}
	}
}
```

You can also specify `*` instead of a language code, in which case the Build Specification will be applied to all default languages. See the [PHP Configuration](#php-configuration) section for instructions on how to set the default languages. If the default languages are not set, `*` will be ignored.

```
{
	"buildLabel": {
		"*": {
			"P2": "$"
		},
		"de": {
			"P3": "$"
		}
	}
}
```

The `$` symbol is replaced by the Main Value of the first Statement with the specified Property. Currently, only strings are supported. Preferred Statements will be used over those with a Normal rank. If there is no matching Statement, that part of the value is omitted. If the resulting value is an empty string, it will be ignored.

It is possible to combine multiple values and to include whitespace and other characters.

```
{
	"de": {
		"P3": "$ ",
		"P4": "$",
		"P5": ", $"
	}
}
```

Assuming P4 is `foo`, P5 is `bar` and there not being a P3 Statement, the above would result in `foo, bar`.

You can also get the value of Qualifiers. This is done via the `P1.P2` notation, where P1 is the Property of the Statement, and P2 is the Property of the Qualifier.

```
{
	"de": {
		"P3": "$ ",
		"P3.P10": "$",
		"P3.P11": ", $"
	}
}
```

In case of Aliases, all matching Statements will be used, possibly resulting in multiple Aliases. The above snippet would create two Aliases, if there are two Statements with Property P3. This is only supported for Build Specifications that use a single Statement-level Property. The below snippet would result in only a single Alias, even if there are many Statements.

```
{
	"de": {
		"P3": "$",
		"P4": "$"
	}
}
```

### When Rules are applied

[](#when-rules-are-applied)

Rules are applied on every edit. They are not applied outside of edits. So if you are importing a dataset and wish the Rules to be applied, you need to first define the Rules and then do the import. Alternatively you can trigger an edit of each page with some MediaWiki script, though this functionality is not provided by the Automated Values extension.

Rules are applied in order. In other words, the second Rule can override values set by the first Rule.

### Limitations

[](#limitations)

- When editing an Entity, the UI will not immediately show the updated generated values. A page reload is needed.
- You can only filter Entities based on Statement Main Values of type String or Entity ID.
- You can only generate Labels and Aliases.
- Rules are only applied to Entities on edit. Changing a rule will not automatically apply it everywhere.
- The editing UI is still present for automatically generated values, possibly causing confusion.

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

[](#installation)

Platform requirements:

- [PHP](https://www.php.net) 7.4 or later (tested up to 8.4)
- [MediaWiki](https://www.mediawiki.org) 1.35 or later (tested up to 1.43)
- [Wikibase](https://wikibase.consulting/what-is-wikibase/) 1.35 or later (tested up to 1.43)

The recommended way to install Automated Values is using [Composer](https://getcomposer.org) with [MediaWiki's built-in support for Composer](https://professional.wiki/en/articles/installing-mediawiki-extensions-with-composer).

On the commandline, go to your wiki's root directory. Then run these two commands:

```
COMPOSER=composer.local.json composer require --no-update professional-wiki/wikibase-automated-values:~1.0
```

```
composer update professional-wiki/wikibase-automated-values --no-dev -o
```

Then enable the extension by adding the following to the bottom of your wikis [LocalSettings.php](https://www.mediawiki.org/wiki/Manual:LocalSettings.php) file:

```
wfLoadExtension( 'AutomatedValues' );
```

You can verify the extension was enabled successfully by opening your wikis Special:Version page in your browser.

To enable more convenient editing of `MediaWiki:AutomatedValues`, you can optionally install the [CodeMirror extension](https://www.mediawiki.org/wiki/Extension:CodeMirror).

PHP Configuration
-----------------

[](#php-configuration)

Configuration can be changed via [LocalSettings.php](https://www.mediawiki.org/wiki/Manual:LocalSettings.php).

### Default languages

[](#default-languages)

List of languages to create values for via '\*' build specifications.

Variable: `$wgAutomatedValuesDefaultLanguages`

Default: `[]`

Example: `[ 'en', 'de', 'nl' ]`

If the value of this configuration is an empty list, '\*' build specifications will be ignored.

### Rules

[](#rules)

List of rules applied to the wiki. In JSON format, following the JSON Schema at [schema.json](https://github.com/ProfessionalWiki/AutomatedValues/blob/master/schema.json). Gets combined with rules defined on page `MediaWiki:AutomatedValues`.

Variable: `$wgAutomatedValuesRules`

Default: `""`

Example:

```
$wgAutomatedValuesRules = '
[
	{
		"buildLabel": {
			"en": {
				"P2": "$"
			}
		}
	}
]
';
```

**Caution**: invalid JSON will be *ignored*. No error will be shown, the intended rules will just not be applied.

### Enable in-wiki rules

[](#enable-in-wiki-rules)

If it should be possible to define rules via MediaWiki:AutomatedValues.

Variable: `$wgAutomatedValuesEnableInWikiConfig`

Default: `true`

Example: `false`

The page MediaWiki:AutomatedValues will always be available. If this configuration is set to `false`, its contents will be ignored.

Development
-----------

[](#development)

To ensure the dev dependencies get installed, have this in your `composer.local.json`:

```
{
	"require": {
		"vimeo/psalm": "^4",
		"phpstan/phpstan": "^1.4.9"
	},
	"extra": {
		"merge-plugin": {
			"include": [
				"extensions/AutomatedValues/composer.json"
			]
		}
	}
}
```

### Running tests and CI checks

[](#running-tests-and-ci-checks)

You can use the `Makefile` by running make commands in the `AutomatedValues` directory.

- `make ci`: Run everything
- `make test`: Run all tests
- `make cs`: Run all style checks and static analysis

Alternatively, you can execute commands from the MediaWiki root directory:

- PHPUnit: `php tests/phpunit/phpunit.php -c extensions/AutomatedValues/`
- Style checks: `vendor/bin/phpcs -p -s --standard=extensions/AutomatedValues/phpcs.xml`
- PHPStan: `vendor/bin/phpstan analyse --configuration=extensions/AutomatedValues/phpstan.neon --memory-limit=2G`
- Psalm: `php vendor/bin/psalm --config=extensions/AutomatedValues/psalm.xml`

### High-level design

[](#high-level-design)

The `Domain/` folder contains the domain model, which is both independent of MediaWiki code and wiki concepts beyond the Wikibase DataModel. In other words, the `Domain/` folder is the core of the application, with no outgoing dependencies.

`Hooks.php` acts as entry point. `AutomatedValuesFactory` is the top level factory, responsible for object graph construction.

Release notes
-------------

[](#release-notes)

### Version 1.1.0 - 2025-02-25

[](#version-110---2025-02-25)

Feature release with these enhancements:

- Translation updates
- Removed unused Resource Loader module (minute performance enhancement)
- Verified support for MediaWiki up to 1.43 and PHP up to 8.4 (1.0.0 is already compatible)

### Version 1.0.0 - 2022-04-29

[](#version-100---2022-04-29)

Initial release for Wikibase 1.35 - 1.37 ([Release announcement](https://www.wikibase.consulting/automating-values-in-wikibase/), [Demo video](https://www.youtube.com/watch?v=BO58wulCFVU)) with these features:

- Ability to build labels and aliases using segmented templates
- Ability to use both Statement Main Values and Qualifier values
- Ability to restrict application of Rules to Entities with specific String or EntityId values for a given Property
- Ability to define Rules on-wiki via the MediaWiki:AutomatedValues page

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance49

Moderate activity, may be stable

Popularity31

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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 ~1033 days

Total

2

Last Release

447d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/451bd4039d530fed8f9c3da91bfa519233a397d2182cdfdcad700f6cfea19b7f?d=identicon)[Jeroen De Dauw](/maintainers/Jeroen%20De%20Dauw)

![](https://avatars.githubusercontent.com/u/1104078?v=4)[Karsten Hoffmeyer](/maintainers/kghbln)[@kghbln](https://github.com/kghbln)

---

Top Contributors

[![JeroenDeDauw](https://avatars.githubusercontent.com/u/146040?v=4)](https://github.com/JeroenDeDauw "JeroenDeDauw (78 commits)")[![translatewiki](https://avatars.githubusercontent.com/u/24829418?v=4)](https://github.com/translatewiki "translatewiki (32 commits)")[![malberts](https://avatars.githubusercontent.com/u/1428594?v=4)](https://github.com/malberts "malberts (3 commits)")[![alistair3149](https://avatars.githubusercontent.com/u/9260542?v=4)](https://github.com/alistair3149 "alistair3149 (2 commits)")[![kghbln](https://avatars.githubusercontent.com/u/1104078?v=4)](https://github.com/kghbln "kghbln (1 commits)")[![Universal-Omega](https://avatars.githubusercontent.com/u/54654040?v=4)](https://github.com/Universal-Omega "Universal-Omega (1 commits)")

---

Tags

automationmediawikimediawiki-extensionwikibasewikibase-extensionmediawikiwikibase

###  Code Quality

Static AnalysisPHPStan, Psalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/professional-wiki-wikibase-automated-values/health.svg)

```
[![Health](https://phpackages.com/badges/professional-wiki-wikibase-automated-values/health.svg)](https://phpackages.com/packages/professional-wiki-wikibase-automated-values)
```

###  Alternatives

[mediawiki/chameleon-skin

A highly flexible MediaWiki skin using Bootstrap 4

12481.8k2](/packages/mediawiki-chameleon-skin)[mediawiki/maps

Adds various mapping features to MediaWiki

84145.0k3](/packages/mediawiki-maps)[professional-wiki/network

MediaWiki extension for adding interactive network visualizations to your wiki pages

3211.9k](/packages/professional-wiki-network)[mediawiki/semantic-glossary

A terminology markup extension with a Semantic MediaWiki back-end

1352.4k](/packages/mediawiki-semantic-glossary)[mediawiki/semantic-extra-special-properties

Provides extra special properties for Semantic MediaWiki

3074.6k1](/packages/mediawiki-semantic-extra-special-properties)[mediawiki/semantic-scribunto

A Semantic Mediawiki extension to natively support the Scribunto extension

2967.5k](/packages/mediawiki-semantic-scribunto)

PHPackages © 2026

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