Download the PHP package solvebeam/wp-text-domain-replacer without Composer

On this page you can find all versions of the php package solvebeam/wp-text-domain-replacer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wp-text-domain-replacer

SolveBeam WordPress Text Domain Replacer

A developer tool for replacing WordPress translation text domains in PHP, JavaScript, and block.json files.

Latest Stable Version Total Downloads License

Table of contents

Why This Tool Exists

This tool was created for a common WordPress development workflow: reusing existing plugins or libraries inside another plugin or theme.

A well-known example is Action Scheduler, which explicitly states:

"Action Scheduler is designed to be used and released in plugins."

That is exactly where translation issues can appear.

When you embed a reusable library, it often keeps its own text domain (for example action-scheduler). If your plugin uses another text domain (for example my-plugin), WordPress will not automatically treat those strings as part of your plugin's translations.

In practice, this means your plugin can be translated, but embedded library strings may remain untranslated for users.

This package solves that build-time problem by replacing the embedded library text domain with your plugin's text domain across your source files. For example:

After this replacement, all translatable strings consistently use your plugin's domain, so they can be handled in one translation flow. This is especially useful for teams distributing plugins/themes that bundle reusable WordPress components.

Getting Started

Installation

To start replacing text domains in your WordPress plugin or theme, require SolveBeam WordPress Text Domain Replacer in Composer:

First Run

To replace text domains in your project, use the wptdr command from the vendor/bin/ directory:

This will scan your src directory for any occurrence of the text domain old_domain in PHP files, JavaScript files, and block.json files, and replace them with new_domain.

Command Line Usage

Options

--dir=DIRECTORY

Specifies the directory to scan for text domain replacements. Defaults to the current working directory if not provided.

Example: --dir=src or --dir=.

--search=DOMAIN

The text domain to search for. You can specify multiple search domains by repeating this option.

Example: --search=old_domain or --search=old_domain --search=legacy_domain

--replace=DOMAIN

The text domain to replace with. This is required.

Example: --replace=new_domain

--exclude=PATTERN

Exclude directories or files by name. You can specify multiple patterns by repeating this option.

Example: --exclude=node_modules --exclude=vendor

Examples

Basic replacement in current directory:

Replace in specific directory:

Replace multiple text domains:

Replace while excluding directories:

Add to Composer scripts:

Then run with:

Configuration via composer.json

Instead of passing all options via command line, you can also configure the text domain replacer in your composer.json file. This is useful for keeping your configuration in one place and simplifying your Composer scripts.

Setup

Add a new extra section to your composer.json:

Running with Configuration

Once configured in composer.json, you can run the tool without any options:

The tool will automatically load the configuration from composer.json and apply it.

Overriding Configuration

Command-line options always take precedence over composer.json configuration. This allows you to override specific settings when needed:

Alternatives

Here is a list of alternatives that we found:

npm

Links


All versions of wp-text-domain-replacer with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package solvebeam/wp-text-domain-replacer contains the following files

Loading the files please wait ...