PHPackages                             intelligenia/behistun - 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. [Templating &amp; Views](/categories/templating)
4. /
5. intelligenia/behistun

ActiveLibrary[Templating &amp; Views](/categories/templating)

intelligenia/behistun
=====================

A simple translation manager for your PHP application

v0.1.3(9y ago)0501MITPHPPHP &gt;=5.4.0

Since Apr 20Pushed 9y ago5 watchersCompare

[ Source](https://github.com/intelligenia/behistun)[ Packagist](https://packagist.org/packages/intelligenia/behistun)[ RSS](/packages/intelligenia-behistun/feed)WikiDiscussions master Synced 4w ago

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

behistun
========

[](#behistun)

Behistun is a simple PHP translation manager

Requirements
============

[](#requirements)

PHP 5.4 and dependencies installed by [composer](https://getcomposer.org/) ([AdoDB](http://adodb.org/dokuwiki/doku.php) and [Twig template system](http://twig.sensiolabs.org/)).

Installation
============

[](#installation)

Install from packagist typing:

```
composer install
```

Configuration
=============

[](#configuration)

Define the available languages
------------------------------

[](#define-the-available-languages)

```
// For example we are going to translate to Spanish and French
$LANGUAGES = ["es_ES", "fr_FR"];
```

Load the file init.php file from the behistun package
-----------------------------------------------------

[](#load-the-file-initphp-file-from-the-behistun-package)

Load the init.php file in your index.php or init.php file.

```
require_once __DIR__ . '/vendor/intelligenia/behistun/behistun/init.php';
```

Use
===

[](#use)

Templates
---------

[](#templates)

This package relies on the Twig template system so you will have to use the following Twig tag to mark a block of text as translatable:

```
{% translatable '' %}
This text will be translated
{% endtranslatable %}
```

The id will be used to identify the block of translatable text when dealing with translations. You should set it to value that helps you recognize easily the block it represents.

Compile all source texts from templates
---------------------------------------

[](#compile-all-source-texts-from-templates)

Run this PHP script that will get all the source texts and create a **locales/LANGUAGE\_CODE/LC\_MESSAGES/** directory in the same directory your templates:

```
php vendor/intelligenia/behistun/behistun/bin/update_translations.php   [purge]
```

For example:

```
php vendor/intelligenia/behistun/behistun/bin/update_translations.php ~/projects/my-web/public_html/templates/ en_US
```

Translation
-----------

[](#translation)

This **locales/LANGUAGE\_CODE/LC\_MESSAGES/** directory contains two files:

### web.source.php

[](#websourcephp)

Original association between translatable ids and source texts.

### web.translation.php

[](#webtranslationphp)

Where each translation goes. Remember that each translation is identified by the id you used in the translatable tag.

Changing language
-----------------

[](#changing-language)

```
// Call Translator class with the language code you want to translate the texts
// this code only should be executed once, when you have a selected language that is
// different from the default language (e.g. English if your web is for English-speaking people)
$translator = new Translator($LANGUAGE);
```

License
=======

[](#license)

[MIT License](LICENSE).

Authors
=======

[](#authors)

- First prototype made by Diego J. Romero López at intelligenia ()

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity51

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

4

Last Release

3358d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9d9dd7453de718304c16dad291cb8f0e799cd63e4f064ce4202d2b21088ee44e?d=identicon)[moralesgea](/maintainers/moralesgea)

![](https://www.gravatar.com/avatar/5468552a7b5cd8f37ee341bb30d42f0b80f8d5edac167c0897e03c2d20020ab9?d=identicon)[diegojromerolopez](/maintainers/diegojromerolopez)

---

Top Contributors

[![diegojromerolopez](https://avatars.githubusercontent.com/u/3748446?v=4)](https://github.com/diegojromerolopez "diegojromerolopez (17 commits)")

---

Tags

translationstwigtwig-tagtwigtranslationmanager

### Embed Badge

![Health badge](/badges/intelligenia-behistun/health.svg)

```
[![Health](https://phpackages.com/badges/intelligenia-behistun/health.svg)](https://phpackages.com/packages/intelligenia-behistun)
```

###  Alternatives

[timber/timber

Create WordPress themes with beautiful OOP code and the Twig Template Engine

5.7k3.6M127](/packages/timber-timber)[twig/intl-extra

A Twig extension for Intl

36567.2M320](/packages/twig-intl-extra)[symfony/ux-twig-component

Twig components for Symfony

22017.2M313](/packages/symfony-ux-twig-component)[symfony/ux-live-component

Live components for Symfony

1636.5M115](/packages/symfony-ux-live-component)[twig/cssinliner-extra

A Twig extension to allow inlining CSS

22919.7M81](/packages/twig-cssinliner-extra)[twig/inky-extra

A Twig extension for the inky email templating engine

16613.2M70](/packages/twig-inky-extra)

PHPackages © 2026

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