PHPackages                             wikitran/wikitran - 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. wikitran/wikitran

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

wikitran/wikitran
=================

Translate terms using Wikipedia

0.0.0(8y ago)018MITPHPPHP ^7.0

Since Sep 1Pushed 8y agoCompare

[ Source](https://github.com/kilych/php-wikitran)[ Packagist](https://packagist.org/packages/wikitran/wikitran)[ Docs](https://github.com/kilych/php-wikitran)[ RSS](/packages/wikitran-wikitran/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

Wikitran
========

[](#wikitran)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9f6194ada18e1d70523f13487a3c4792a85ceb2e34384296801dbfa8f44aeac1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f77696b697472616e2f77696b697472616e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/wikitran/wikitran)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

[![Total Downloads](https://camo.githubusercontent.com/d8a1046fdafbdb82d935b8f1e22f55807f4198f2b44e1389e92d068b19671ad3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f77696b697472616e2f77696b697472616e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/wikitran/wikitran)

Translate terms using Wikipedia multilingual articles

Installation and usage
----------------------

[](#installation-and-usage)

### As command-line tool

[](#as-command-line-tool)

```
$ composer g require wikitran/wikitran
$ wikitran [  ...]
```

(Be sure set up your $PATH for Composer.)

Use [Wikipedia language codes](https://meta.wikimedia.org/wiki/List_of_Wikipedias#All_Wikipedias_ordered_by_number_of_articles) as source and destination languages. First code is for source language. Rest codes are for destination languages. First word that isn't valid language code will be interpreted as first word of your query for translation.

#### Examples

[](#examples)

##### Specify source and destination languages

[](#specify-source-and-destination-languages)

```
$ wikitran de ar es schreiber
```

Query is "schreiber". Source language is "de" (German). Destination languages are "ar" (Arabic) and "es" (Spanish).

##### Specify destination as all available languages

[](#specify-destination-as-all-available-languages)

```
$ wikitran de all schreiber
```

Source language is "de" (German). Destination languages are all available languages for the query.

##### Use default destination

[](#use-default-destination)

```
$ wikitran de schreiber
```

Source language is "de" (German). Destination language is not set. Default value is "all".

##### Use default source and destination

[](#use-default-source-and-destination)

```
$ wikitran scrivener
```

Source language is not set. Default value is "en" (English). Destination language is not set. Default value is "all".

### As PHP library

[](#as-php-library)

```
$ composer require wikitran/wikitran
```

```
use Wikitran\Translator;

// set russian as default source language instead of english
$tr = new Translator(['source' => 'ru']);

// First arg is for query. Second is for source language (optional).
// Rest are for destination languages (optional).
$pushkin = $tr->translate('Пушкин');
$wiskunde = $tr->translate('wiskunde', 'nl', 'en', 'de', 'fr', 'ru');
```

See also [examples](examples).

Database
--------

[](#database)

You can use SQL database (SQLite and MySQL supported) as cache for already translated terms.

### Migration

[](#migration)

(Using "binary" PHP script)

#### Built-in SQLite database

[](#built-in-sqlite-database)

```
$ wikitran --migrate --createFile
```

#### SQLite

[](#sqlite)

```
$ wikitran --migrate --server sqlite --file  [--createFile]
```

#### MySQL

[](#mysql)

```
$ wikitran --migrate --server mysql --db  --user  [--host ] [--port ] [--password ] [--charset ]
```

### Connection

[](#connection)

#### Built-in SQLite database

[](#built-in-sqlite-database-1)

As default (if built-in db exists).

#### SQLite

[](#sqlite-1)

```
use Wikitran\Translator;

$tr = new Translator(['db' => [
    'server' => 'sqlite',
    'file' => 'path/to/your/db/file'
]]);
```

#### MySQL

[](#mysql-1)

```
use Wikitran\Translator;

// 'password', 'port', etc. are optional
$tr = new Translator(['db' => [
    'server' => 'mysql',
    'db' => 'db_name',
    'user' => 'db_user'
]]);
```

#### PDO instance

[](#pdo-instance)

If you have instance of class PDO, you can set db connection directly in constructor:

```
use Wikitran\Translator;

$tr = new Translator([], $pdo);
```

Or, later:

```
use Wikitran\Translator;

$tr = new Translator();

$tr->setConnection($pdo);
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

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

Unknown

Total

1

Last Release

3177d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/139abd70928843f33a7708228acb3d5a1f3f1bfb5d2a7f64dde8ad35be0061cb?d=identicon)[kilych](/maintainers/kilych)

---

Top Contributors

[![kilych](https://avatars.githubusercontent.com/u/27053821?v=4)](https://github.com/kilych "kilych (78 commits)")

---

Tags

translatorwikipedia

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

PHPackages © 2026

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