PHPackages                             professional-wiki/message-builder - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. professional-wiki/message-builder

ActiveLibrary[Queues &amp; Workers](/categories/queues)

professional-wiki/message-builder
=================================

Mini message localization library with MessageBuilder interface and implementations

1.0.1(1y ago)32.7k↑50%[2 issues](https://github.com/ProfessionalWiki/MessageBuilder/issues)1GPL-2.0-or-laterPHPPHP ^8.1CI passing

Since Feb 20Pushed 1y ago4 watchersCompare

[ Source](https://github.com/ProfessionalWiki/MessageBuilder)[ Packagist](https://packagist.org/packages/professional-wiki/message-builder)[ RSS](/packages/professional-wiki-message-builder/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (3)Used By (1)

Message Builder
===============

[](#message-builder)

[![GitHub Workflow Status](https://camo.githubusercontent.com/2433feb99e8de8f841960cc80bc4f90d18b1964d017475e256fa8fa6c7e19a3a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f50726f66657373696f6e616c57696b692f4d6573736167654275696c6465722f63692e796d6c3f6272616e63683d6d6173746572)](https://github.com/ProfessionalWiki/MessageBuilder/actions?query=workflow%3ACI)[![Type Coverage](https://camo.githubusercontent.com/e3e506bc10d83da1dc198ac6746a2729711249f9173b2245c1913246c9ce8b14/68747470733a2f2f73686570686572642e6465762f6769746875622f50726f66657373696f6e616c57696b692f4d6573736167654275696c6465722f636f7665726167652e737667)](https://shepherd.dev/github/ProfessionalWiki/MessageBuilder)[![codecov](https://camo.githubusercontent.com/0601a4ba8fb4d5175367368f427a7b5cd02bd256ae1625f98fb6de6a830c8228/68747470733a2f2f636f6465636f762e696f2f67682f50726f66657373696f6e616c57696b692f4d6573736167654275696c6465722f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d476e4f4733464631365a)](https://codecov.io/gh/ProfessionalWiki/MessageBuilder)[![Latest Stable Version](https://camo.githubusercontent.com/f3cf31f505dc8149e14b45bef0cada5295f1a59e89cf15812b90b50da1b9cd08/68747470733a2f2f706f7365722e707567782e6f72672f70726f66657373696f6e616c2d77696b692f6d6573736167652d6275696c6465722f762f737461626c65)](https://packagist.org/packages/professional-wiki/message-builder)[![Download count](https://camo.githubusercontent.com/3da566d30cab2c34dc5151c8705ab40f4f4a930c361a8ab91e58e1c16eab4fe8/68747470733a2f2f706f7365722e707567782e6f72672f70726f66657373696f6e616c2d77696b692f6d6573736167652d6275696c6465722f646f776e6c6f616473)](https://packagist.org/packages/professional-wiki/message-builder)[![License](https://camo.githubusercontent.com/7506fe4c7ca2f7f3712a33bf5787f8cd4d43d10b11430d9b376894993ecb065e/68747470733a2f2f706f7365722e707567782e6f72672f70726f66657373696f6e616c2d77696b692f6d6573736167652d6275696c6465722f6c6963656e7365)](LICENSE)

Message Builder is a small message localization library for PHP.

This library was extracted from the [EDTF library](https://github.com/ProfessionalWiki/EDTF). It can be used together with [TranslateWiki](https://translatewiki.net/), though does not depend on it.

MessageBuilder interface
------------------------

[](#messagebuilder-interface)

```
interface MessageBuilder {
	/**
	 * @throws UnknownMessageKey
	 */
	public function buildMessage( string $messageKey, string ...$arguments ): string;
}
```

Usage
-----

[](#usage)

```
$messageBuilder = new ArrayMessageBuilder( [
	'hello-something' => 'Hello, $1!',
	'multi-argument-example' => 'foo $2 $1 bar $3',
	'plural-example' => 'You have $1 {{plural:$1|item|items}} in your cart.',
] );

function someCode( MessageBuilder $messageBuilder ) {
	// Returns 'Hello, world!'
	$messageBuilder->getMessage( 'hello-something', [ 'world' ] );
}
```

For a real world usage example, see the [EDTF library](https://github.com/ProfessionalWiki/EDTF).

Implementations
---------------

[](#implementations)

- `ArrayMessageBuilder` - In-memory message builder with PLURAL keyword support
- `FallbackMessageBuilder` - Fallback message builder that delegates to multiple message builders
- `MessageBuilderSpy` - Message builder that records all messages built for testing

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

[](#development)

Start by installing the project dependencies by executing

```
composer install

```

You can run test and static analysis via Make. See Makefile for available commands. If you do not have Make, you can run the commands listed in the Makefile manually.

To run all checks run by the GitHub Actions CI, simply run `make`.

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

[](#release-notes)

### Version 1.0.1 (2025-02-21)

[](#version-101-2025-02-21)

- Removed superfluous `ext-json` dependency.

### Version 1.0.0 (2025-02-20)

[](#version-100-2025-02-20)

- Initial release with `ArrayMessageBuilder`, `FallbackMessageBuilder`, and `MessageBuilderSpy` implementations.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance30

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

451d 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 (14 commits)")

---

Tags

messagelocalizationi18nl10ntranslatemediawikitranslatewiki

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/professional-wiki-message-builder/health.svg)

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

###  Alternatives

[symfony/intl

Provides access to the localization data of the ICU library

2.6k199.8M1.1k](/packages/symfony-intl)[gettext/languages

gettext languages with plural rules

7530.3M11](/packages/gettext-languages)[punic/punic

PHP-Unicode CLDR

1542.9M29](/packages/punic-punic)[aplus/language

Aplus Framework Language Library

2351.7M15](/packages/aplus-language)[aura/intl

The Aura Intl package provides internationalization tools, specifically message translation.

898.3M4](/packages/aura-intl)[fisharebest/localization

A lightweight localization database and translation tools, with data from the CLDR, IANA, ISO, etc.

3191.1k2](/packages/fisharebest-localization)

PHPackages © 2026

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