PHPackages                             cyberspectrum/contao-toolbox - 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. cyberspectrum/contao-toolbox

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

cyberspectrum/contao-toolbox
============================

Contao ToolBox

0.7.2(9y ago)1026.3k↓100%2[4 issues](https://github.com/cyberspectrum/contao-toolbox/issues)3LGPL-3.0+PHPPHP &gt;=5.5

Since Jun 1Pushed 2y ago2 watchersCompare

[ Source](https://github.com/cyberspectrum/contao-toolbox)[ Packagist](https://packagist.org/packages/cyberspectrum/contao-toolbox)[ Docs](http://cyberspectrum.de)[ RSS](/packages/cyberspectrum-contao-toolbox/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (13)Used By (3)

[![Build Status](https://camo.githubusercontent.com/99f451cc557df175a29db48136508d2cf6ed7b820d4458456668f0dcd0b87a2c/68747470733a2f2f7472617669732d63692e6f72672f6379626572737065637472756d2f636f6e74616f2d746f6f6c626f782e706e67)](https://travis-ci.org/cyberspectrum/contao-toolbox)[![Latest Version tagged](https://camo.githubusercontent.com/90f4136a5ff05845a25fe621e2046287c9c3bd0826d46e0508987fc5e460d972/687474703a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f6379626572737065637472756d2f636f6e74616f2d746f6f6c626f782e737667)](https://github.com/cyberspectrum/contao-toolbox/tags)[![Latest Version on Packagist](https://camo.githubusercontent.com/a2179700222f6c5ca7f323da07701b9705380b3bc42e60068949405fa275b85a/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6379626572737065637472756d2f636f6e74616f2d746f6f6c626f782e737667)](https://packagist.org/packages/cyberspectrum/contao-toolbox)[![Installations via composer per month](https://camo.githubusercontent.com/58bb13a6dd0fe4f9939963f6a46dc93e308cff31779601cf0371689a25f548f4/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6379626572737065637472756d2f636f6e74616f2d746f6f6c626f782e737667)](https://packagist.org/packages/cyberspectrum/contao-toolbox)[![Dependency Status](https://camo.githubusercontent.com/a240c659b512bece52c7563aa9baf7fe24262facdd8ef1618415ca3cdd9badc3/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f7068702f6379626572737065637472756d3a636f6e74616f2d746f6f6c626f782f62616467652e737667)](https://www.versioneye.com/php/cyberspectrum:contao-toolbox)

Contao Toolbox
==============

[](#contao-toolbox)

This toolbox provides easy ways to generate .xlf (XLIFF) files from Contao language files, push them to transifex and pull translations from transifex and convert them back to Contao language files.

It can be used and distributed either as set of seperate files (this git repository) or compiled to a `phar` file.

How to get it
-------------

[](#how-to-get-it)

### via composer

[](#via-composer)

1. Download composer (if not done already)

```
curl -sS https://getcomposer.org/installer | php

```

2. Install the application.

```
php composer create-project --prefer-source cyberspectrum/contao-toolbox

```

**Hint:** At the end of the installation composer will ask you to remove the vcs history:

> Do you want to remove the existing VCS (.git, .svn..) history? \[Y,n\]?

You must not confirm this question, type `n` to keep the history, otherwise the compiler will not work!

### via plain git cloning

[](#via-plain-git-cloning)

```
git clone https://github.com/discordier/contao-toolbox.git

```

When using Git, update the contao-toolbox repository and all dependencies via composer at the beginning.

```
php composer update

```

#### Optionally compile the `ctb.phar` binary for distribution.

[](#optionally-compile-the-ctbphar-binary-for-distribution)

After fetching the source, you can use the shipped compiler to generate a `phar` file to install in a system wide path for easier usage.

```
./bin/compile-ctb

```

Note: this requires the php.ini setting:

```
[Phar]
phar.readonly = Off

```

See also

How to use it.
--------------

[](#how-to-use-it)

For brevity reasons, we only use the ctb.phar notation in the examples, if you have not compiled the phar file you can swap each `ctb.phar` by `path/to/ctb` in the following commands. We furthermore assume that the `ctb.phar` is in the search path of your system, if not please use the full path to the binary then.

Commands
--------

[](#commands)

The Contao Toolbox currently provides the following commands:

- `help`Displays help for a command
- `list`Lists commands
- `download-transifex`Download xliff translations from transifex.
- `upload-transifex`Upload xliff translations to transifex.
- `from-xliff`Update Contao language files from xliff translations.
- `to-xliff`Update xliff translations from Contao base language.
- `cleanup-tx`Purges the defined .tx folder.

### The `help` command.

[](#the-help-command)

Display information about a certain command.

You can issue `ctb.phar help ` to get detailed information about a specific command.

NOTE: the output of the help command may be more up to date than this README.md file.

### The `list` command.

[](#the-list-command)

List the available commands.

### Common parameters to all commands

[](#common-parameters-to-all-commands)

All commands (except for help and list) handle certain parameters.

Some of these parameters can be omitted as the tool will then retrieve them from composer.json from the sub key `extra/contao/transifex`

If neither defined via command line or composer.json, the tool will fallback to from the global configuration in the user's home directory.

The config file name to use is determined as: If the environment variable `CBT_HOME` has been defined, this is the home directory to use. If running on Windows, the environment variable `APPDATA` is used and suffixed with `/CBT/config.json`. If running on any other OS, the environment variable `HOME` is being examined and suffixed with `.config/ctb/config.json`.

##### --working-dir (-d)

[](#--working-dir--d)

If specified, use the given directory as working directory. This is useful for the location of the `composer.json` file to use as this will always be loaded from the current working directory.

##### --contao (-c)

[](#--contao--c)

Contao language root directory (base to "en","de" etc.). If this is not given, it will first tried to read it from the composer.json of the current working directory and second tried to retrieve it from the global configuration. This usually is something like `system/modules//languages/`

This value will get read from the key `extra/contao/transifex/languages_cto` in composer.json if omitted.

**Example:**If we have the extension acme-core and are within the contao core root directory, we will pass: `-c src/system/modules/acme-core/languages`

##### --xliff (-x)

[](#--xliff--x)

Xliff root directory (base to "en","de" etc.), if empty it will get read from the composer.json. This can be any path where the xlf files shall be stored locally. Note that this tool will create a subdirectory for every language in use. Use the command `cleanup-tx` to quickly clean up this folder right from the command line.

This value will get read from the key `extra/contao/transifex/languages_tx` in composer.json if omitted.

##### --projectname (-p)

[](#--projectname--p)

This is the name of the project on transifex. This value will get read from the key `extra/contao/transifex/project` in composer.json if omitted.

##### --prefix

[](#--prefix)

The prefix for all language files, if empty it will get read from the composer.json. This tool provides the possibility to limit the resources on transifex it will take into account by some prefix. Using this approach allows to store the language files of multiple sub projects within a single transifex project.

This value will get read from the key `extra/contao/transifex/prefix` in composer.json if omitted.

**Example:**Assume we have the Contao extension "acme" with the sub projects "acme-core" and "acme-more". We want to have the language file `default.php` from "acme-core" to be handled as `core-default` and the file from "acme-more" shall get stored as `more-default` on transifex.

We now need to pass `--prefix core` when working with the "acme-core" directory and `--prefix more` when dealing with the "acme-more" directory.

##### --base-language (-b) The base language to use. (default: "en")

[](#--base-language--b--the-base-language-to-use-default-en)

This defines the language to be used as source language on transifex and in the xlf files.

##### --skip-files (-s)

[](#--skip-files--s)

This option can be used to skip certain language files.

This value will get read from the key `extra/contao/transifex/skip_files` in composer.json if omitted.

**Example:**Assume we have a file named "skipme.php" in the languages folder that does not have any related data on transifex. By adding "skipme" to the list of files to skip, this will not be considered.

### Managing translations on transifex.

[](#managing-translations-on-transifex)

#### Common parameters to transifex commands

[](#common-parameters-to-transifex-commands)

##### --user (-U)

[](#--user--u)

This is the transifex user to be used. If this is not given, the tool first checks the global configuration for a username in the key `/transifex/user`. If there is no user provided, the tool checks the environment variable `transifexuser`. If still no user has been defined, the tool interactively asks on the command line.

##### --pass (-P)

[](#--pass--p)

This is the password for the given transifex user. If this is not given, the tool first checks the global configuration for a password in the key `/transifex/pass`. If there is no user provided, the tool checks the environment variable `transifexpass`. If still no password has been defined, the tool interactively asks on the command line.

###### --mode (-m)

[](#--mode--m)

This parameter is optional and defaults to: "reviewed".

The download mode to use (reviewed, translated, default).

#### Command `download-transifex`

[](#command-download-transifex)

This command downloads all xlf files for the given languages from transifex. It takes a single argument consisting of either the keyword `all` or a comma separated list of language keys.

Example 1 (download all available languages): `ctb.phar download-transifex all`

Example 2 (download the languages German, English and French): `ctb.phar download-transifex de,en,fr`

#### Command `upload-transifex`

[](#command-upload-transifex)

This command uploads all xlf files for the given languages from transifex. It takes a single argument consisting of either the keyword `all` or a comma separated list of language keys.

Example 1 (download all available languages): `ctb.phar upload-transifex all`

Example 2 (download the languages German, English and French): `ctb.phar upload-transifex de,en,fr`

### Commands for transforming the XLIFF (xlf) files to/from Contao language files.

[](#commands-for-transforming-the-xliff-xlf-files-tofrom-contao-language-files)

#### Common parameters to transforming commands

[](#common-parameters-to-transforming-commands)

###### --cleanup

[](#--cleanup)

If this is passed, obsolete files will get removed. All files not present in the corresponding source section or empty files will get deleted in the destination.

#### Command `from-xliff`

[](#command-from-xliff)

This command will convert the xliff files from the defined transifex folder into the Contao folder for the given languages.

It takes a single argument consisting of either the keyword `all` (default) or a comma separated list of language keys.

#### Command `to-xliff`

[](#command-to-xliff)

This command will convert the xliff files from the defined Contao folder into files in transifex folder for the given languages.

It takes a single argument consisting of either the keyword `all` (default) or a comma separated list of language keys.

Example configuration
---------------------

[](#example-configuration)

### Example `composer.json` except.

[](#example-composerjson-except)

```
{
	"extra":{
		"contao": {
			"transifex": {
				"project": "acme-core",
				"prefix": "core-",
				"languages_cto": "src/system/modules/acme-core/languages",
				"languages_tx": ".tx"
			}
		}
	}
}
```

### example `$HOME/.config/ctb/config.json`

[](#example-homeconfigctbconfigjson)

```
{
	"transifex": {
		"user": "john-doe",
		"pass": "sUp3rPassword!"
	}
}
```

### Common usage

[](#common-usage)

```
# Convert all .php files to .xlf files updating existing ones.
user@host:~/some/project$ ctb.phar to-xliff

# Upload the xlf files to transifex (adding new ones and new language strings to existing ones).
user@host:~/some/project$ ctb.phar upload-transifex

# Download new translation strings from transifex.
user@host:~/some/project$ ctb.phar download-transifex -m translated

# Convert all received xlf files back to php files in their corresponding location.
user@host:~/some/project$ ctb.phar from-xliff

# Finally clean up the ".tx" folder
user@host:~/some/project$ ctb.phar cleanup-tx

```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance12

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 78% 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 ~131 days

Recently: every ~258 days

Total

11

Last Release

3411d ago

PHP version history (3 changes)0.5.0PHP &gt;=5.3.3

0.7.0PHP &gt;=5.4

0.7.2PHP &gt;=5.5

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/44649522?v=4)[xtra](/maintainers/xtra)[@xtra](https://github.com/xtra)

---

Top Contributors

[![discordier](https://avatars.githubusercontent.com/u/940331?v=4)](https://github.com/discordier "discordier (78 commits)")[![Toflar](https://avatars.githubusercontent.com/u/481937?v=4)](https://github.com/Toflar "Toflar (14 commits)")[![tristanlins](https://avatars.githubusercontent.com/u/343404?v=4)](https://github.com/tristanlins "tristanlins (7 commits)")[![andreasisaak](https://avatars.githubusercontent.com/u/156767?v=4)](https://github.com/andreasisaak "andreasisaak (1 commits)")

---

Tags

helpercontaoToolbox

### Embed Badge

![Health badge](/badges/cyberspectrum-contao-toolbox/health.svg)

```
[![Health](https://phpackages.com/badges/cyberspectrum-contao-toolbox/health.svg)](https://phpackages.com/packages/cyberspectrum-contao-toolbox)
```

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M565](/packages/symfony-maker-bundle)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M648](/packages/sylius-sylius)[symplify/monorepo-builder

Not only Composer tools to build a Monorepo.

5205.3M82](/packages/symplify-monorepo-builder)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19462.3M1.3k](/packages/drupal-core)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k17](/packages/civicrm-civicrm-core)[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)

PHPackages © 2026

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