PHPackages                             eden/language - 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. eden/language

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

eden/language
=============

Eden language component.

4.0.1(10y ago)08.4k1MITPHPPHP &gt;=5.4.1

Since Sep 24Pushed 10y ago12 watchersCompare

[ Source](https://github.com/Eden-PHP/Language)[ Packagist](https://packagist.org/packages/eden/language)[ Docs](http://eden-php.com)[ RSS](/packages/eden-language/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (4)Dependencies (5)Versions (6)Used By (1)

[![logo](https://camo.githubusercontent.com/683ba05b2b51f50045c674b19a4f0ceb30702a8ab495623be7c02e07ab226f08/687474703a2f2f6564656e2e6f70656e6f766174652e636f6d2f6173736574732f696d616765732f636c6f75642d736f6369616c2e706e67)](https://camo.githubusercontent.com/683ba05b2b51f50045c674b19a4f0ceb30702a8ab495623be7c02e07ab226f08/687474703a2f2f6564656e2e6f70656e6f766174652e636f6d2f6173736574732f696d616765732f636c6f75642d736f6369616c2e706e67) Eden Language
===================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#-eden-language)

[![Build Status](https://camo.githubusercontent.com/5df9a83f14c0ee723a73d624908cc427b1e5853d07e7b40d73c3672db3b1a2ff/68747470733a2f2f6170692e7472617669732d63692e6f72672f4564656e2d5048502f4c616e67756167652e737667)](https://travis-ci.org/Eden-PHP/Language)
==============================================================================================================================================================================================================================================================

[](#)

- [Install](#install)
- [Introduction](#intro)
- [API](#api)
    - [get](#get)
    - [getLanguage](#getLanguage)
    - [save](#save)
    - [translate](#translate)
- [Contributing](#contributing)

====

Install
-------

[](#install)

`composer install eden/language`

====

Introduction
------------

[](#introduction)

Languages in *Eden* are fairly robust, simply defined and designed to work with other translating services such as *Google Translate*. The follow figure shows how to set up a french translator.

**Figure 1. French Translator**

```
//initial translations
$translations = array(
	'Hello'         => 'Bonjour',
	'How are you?'  => 'Como tale vous?');

//load up the translation
$french = eden('language', $translations);

//you can add translations on the fly
$french->translate('I am good thank you, and you?', 'Bien mercy, et vous?');

//now echo some translations
echo $french->get('Hello'); //--> Bonjour
echo $french->get('How are you?'); //--> Como tale vous?
echo $french->get('I am good thank you, and you?'); //--> Bien mercy, et vous?

```

For ease of use we also made the language object accessable as an array. The next figure shows the same as `Figure 1` except that it's usings arrays to manipulate the object.

**Figure 2. Languages as Arrays**

```
//initial translations
$translations = array(
	'Hello'         => 'Bonjour',
	'How are you?'  => 'Como tale vous?');

//load up the translation
$french = eden('language', $translations);

//you can add translations on the fly
$french['I am good thank you, and you?] = 'Bien mercy, et vous?';

//now echo some translations
echo $french['Hello']; //--> Bonjour
echo $french['How are you?']; //--> Como tale vous?
echo $french['I am good thank you, and you?']; //--> Bien mercy, et vous?

foreach($french as $default => $translation) {
	echo $translation;
}

```

Most commonly, websites using languages usually start and end with loading and saving translation files. Using *Eden's* language object through the life of the page and later saving will keep your languages file always up to date.

> **Note:** Eden does not do the actual translating on its own. Once the file is generated and saved you should run it through a translating service.

**Figure 3. Loading and Saving a Language File**

```
//load up a translation file
$translations = eden('file', '/path/to/french.php')->getData();
$french = eden('language', $translations);

//add to translation
$french['I am good thank you, and you?] = 'Bien mercy, et vous?';

//save back to file
$french->save('/path/to/french.php');

```

====

API
---

[](#api)

====

### get

[](#get)

Returns the translated key. if the key is not set it will set the key to the value of the key

#### Usage

[](#usage)

```
eden('language')->get(string );

```

#### Parameters

[](#parameters)

- `string `

Returns `string`

#### Example

[](#example)

```
eden('language')->get();

```

====

### getLanguage

[](#getlanguage)

Return the language set

#### Usage

[](#usage-1)

```
eden('language')->getLanguage();

```

#### Parameters

[](#parameters-1)

Returns `array`

====

### save

[](#save)

Saves the language to a file

#### Usage

[](#usage-2)

```
eden('language')->save(string|null $file);

```

#### Parameters

[](#parameters-2)

- `string|null $file` - The file to save to

Returns `this`

#### Example

[](#example-1)

```
eden('language')->save();

```

====

### translate

[](#translate)

Sets the translated value to the specified key

#### Usage

[](#usage-3)

```
eden('language')->translate(*string $key, *string $value);

```

#### Parameters

[](#parameters-3)

- `*string $key` - The translation key
- `*string $value` - The default value if we cannot find the translation

Returns `this`

#### Example

[](#example-2)

```
eden('language')->translate('foo', 'foo');

```

====

\#Contributing to Eden

Contributions to *Eden* are following the Github work flow. Please read up before contributing.

\##Setting up your machine with the Eden repository and your fork

1. Fork the repository
2. Fire up your local terminal create a new branch from the `v4` branch of your fork with a branch name describing what your changes are. Possible branch name types:
    - bugfix
    - feature
    - improvement
3. Make your changes. Always make sure to sign-off (-s) on all commits made (git commit -s -m "Commit message")

\##Making pull requests

1. Please ensure to run `phpunit` before making a pull request.
2. Push your code to your remote forked version.
3. Go back to your forked version on GitHub and submit a pull request.
4. An Eden developer will review your code and merge it in when it has been classified as suitable.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 75% 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 ~195 days

Total

5

Last Release

3836d ago

Major Versions

1.0.3 → 4.0.12015-10-13

PHP version history (2 changes)1.0.2PHP &gt;=5.3.1

4.0.1PHP &gt;=5.4.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/120378?v=4)[Christian Blanquera](/maintainers/cblanquera)[@cblanquera](https://github.com/cblanquera)

---

Top Contributors

[![clark21](https://avatars.githubusercontent.com/u/5639521?v=4)](https://github.com/clark21 "clark21 (3 commits)")[![Sherlonv](https://avatars.githubusercontent.com/u/5492326?v=4)](https://github.com/Sherlonv "Sherlonv (1 commits)")

---

Tags

libraryeden

### Embed Badge

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

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

###  Alternatives

[eden/mail

Eden POP3, IMAP and SMTP component

178273.4k1](/packages/eden-mail)[league/iso3166

ISO 3166-1 PHP Library

69536.3M116](/packages/league-iso3166)[eden/core

Eden Core component full of secret sauce

14415.0k34](/packages/eden-core)[eden/sqlite

Eden SQLite Search, Collection, Model ORM componen

199.2k2](/packages/eden-sqlite)

PHPackages © 2026

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