PHPackages                             sultann/wp-addtextdomain - 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. sultann/wp-addtextdomain

ActiveComposer-plugin[Utility &amp; Helpers](/categories/utility)

sultann/wp-addtextdomain
========================

A Composer package to automatically replace text domains in WordPress gettext functions

v1.0.0(1y ago)116GPL-2.0-or-laterPHPPHP &gt;=7.4

Since Apr 8Pushed 1y ago1 watchersCompare

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

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

WP Add Text Domain
==================

[](#wp-add-text-domain)

A Composer package that automatically replaces text domains in WordPress gettext functions. It can be used as a Composer plugin that runs automatically after package installation/update, or as a standalone CLI tool.

Features
--------

[](#features)

- Automatically replaces text domains in WordPress gettext functions
- Runs as a Composer plugin or standalone CLI tool
- Configurable through composer.json or command-line arguments
- Supports all WordPress gettext functions
- Excludes vendor and node\_modules directories by default

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

[](#installation)

### Via Composer (recommended)

[](#via-composer-recommended)

```
composer require sultann/wp-addtextdomain
```

### Manual Installation

[](#manual-installation)

1. Clone the repository:

```
git clone https://github.com/sultann/wp-addtextdomain.git
```

2. Install dependencies:

```
composer install
```

Usage
-----

[](#usage)

### As a Composer Plugin

[](#as-a-composer-plugin)

Add the configuration to your project's `composer.json`:

```
{
    "require": {
        "sultann/wp-addtextdomain": "^1.0"
    },
    "extra": {
        "addtextdomain": {
            "textdomain": "my-new-domain",
            "updateDomains": ["old-domain", "another-old-domain"],
            "files": ["src/", "templates/"]
        }
    }
}
```

### As a CLI Tool

[](#as-a-cli-tool)

```
# Replace single text domain
vendor/bin/addtextdomain new-domain old-domain

# Replace multiple text domains
vendor/bin/addtextdomain new-domain old-domain1 old-domain2

# Process specific directory
vendor/bin/addtextdomain new-domain old-domain --dir=src/
```

Configuration
-------------

[](#configuration)

Add the configuration to your project's `composer.json` under the `extra` section:

```
{
    "extra": {
        "addtextdomain": {
            "textdomain": "my-new-domain",        // Required: New text domain to use
            "updateDomains": ["old-one", "old2"], // Required: List of old domains to replace
            "files": [                            // Optional: Files or directories to scan
                "includes/",
                "functions.php"
            ]
        }
    }
}
```

### Configuration Options

[](#configuration-options)

- `textdomain`: (Required) The new text domain to use for replacement
- `updateDomains`: (Required) Array of old text domains to be replaced
- `files`: (Optional) Array of files or directories to scan. If not provided, all PHP files in the root and subdirectories will be scanned

### Automatic Exclusions

[](#automatic-exclusions)

The following directories are automatically excluded from scanning:

- `vendor/`
- `node_modules/`

### Supported WordPress Functions

[](#supported-wordpress-functions)

The package processes the following WordPress gettext functions:

- `__()`
- `_e()`
- `_x()`
- `_n()`
- `_nx()`
- `_ex()`
- `_n_noop()`
- `_nx_noop()`
- `translate()`
- `esc_html__()`
- `esc_html_e()`
- `esc_html_x()`
- `esc_attr__()`
- `esc_attr_e()`
- `esc_attr_x()`

License
-------

[](#license)

GPL-2.0-or-later

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance46

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

406d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/888ecb9bec980eb4758575606e394842d4552fe72897e5183af8bb656035fba7?d=identicon)[sultann](/maintainers/sultann)

---

Top Contributors

[![sultann](https://avatars.githubusercontent.com/u/5239470?v=4)](https://github.com/sultann "sultann (1 commits)")

### Embed Badge

![Health badge](/badges/sultann-wp-addtextdomain/health.svg)

```
[![Health](https://phpackages.com/badges/sultann-wp-addtextdomain/health.svg)](https://phpackages.com/packages/sultann-wp-addtextdomain)
```

###  Alternatives

[vaimo/composer-patches

Applies a patch from a local or remote file to any package that is part of a given composer project. Patches can be defined both on project and on package level. Optional support for patch versioning, sequencing, custom patch applier configuration and patch command for testing/troubleshooting added patches.

2994.3M16](/packages/vaimo-composer-patches)[mglaman/composer-drupal-lenient

1317.4M15](/packages/mglaman-composer-drupal-lenient)[drupal/core-composer-scaffold

A flexible Composer project scaffold builder.

5341.9M446](/packages/drupal-core-composer-scaffold)[drupal/core-project-message

Adds a message after Composer installation.

2122.6M172](/packages/drupal-core-project-message)[olvlvl/composer-attribute-collector

A convenient and near zero-cost way to retrieve targets of PHP 8 attributes

184108.8k8](/packages/olvlvl-composer-attribute-collector)[lullabot/drainpipe

An automated build tool to allow projects to have a set standardized operations scripts.

41716.4k2](/packages/lullabot-drainpipe)

PHPackages © 2026

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