PHPackages                             davidlienhard/i18n - 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. [Localization &amp; i18n](/categories/localization)
4. /
5. davidlienhard/i18n

ActiveLibary[Localization &amp; i18n](/categories/localization)

davidlienhard/i18n
==================

🐘 php library to use for internationalization

2.1.1(5mo ago)06.0kMITPHPPHP ^8.4CI passing

Since Nov 12Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/davidlienhard/i18n)[ Packagist](https://packagist.org/packages/davidlienhard/i18n)[ Docs](https://github.com/davidlienhard/i18n/)[ RSS](/packages/davidlienhard-i18n/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (16)Used By (0)

davidlienhard/i18n
==================

[](#davidlienhardi18n)

🐘 php library to use for internationalization

[![Latest Stable Version](https://camo.githubusercontent.com/0842cfae2a9de72761a8c342c97ec99c4589b52e305b6fd8de90c199269ba82d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64617669646c69656e686172642f6931386e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/davidlienhard/i18n)[![Source Code](https://camo.githubusercontent.com/6283fdbe8085836de5a0dcd0ad5657b1a240535350c0c2cb040bd4c742103ee0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f736f757263652d64617669646c69656e686172642f6931386e2d626c75652e7376673f7374796c653d666c61742d737175617265)](https://github.com/davidlienhard/i18n)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/davidlienhard/i18n/blob/master/LICENSE)[![Minimum PHP Version](https://camo.githubusercontent.com/7f91fd16f805b376c8b9137ddc479aabdc9f79d19807832f85606cb3b74409c4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230382e302d3838393242462e7376673f7374796c653d666c61742d737175617265)](https://php.net/)[![CI Status](https://github.com/davidlienhard/i18n/actions/workflows/check.yml/badge.svg)](https://github.com/davidlienhard/i18n/actions/workflows/check.yml)

Setup
-----

[](#setup)

You can install through `composer` with:

```
composer require davidlienhard/i18n:^2

```

*Note: davidlienhard/i18n requires PHP 8.0*

How to use
----------

[](#how-to-use)

### 1. Create language files

[](#1-create-language-files)

Create at least one language file. Supported filetypes are `json`, `yaml`, `yml` or `ini`.

`./lang/en.yml` (English)

```
save: Save
greeting: Hi %1
```

`./lang/de.yml` (German)

```
save: Speichern
greeting: Hallo %1
```

### 2. Load the class

[](#2-load-the-class)

Use composer autoloader if possible or include the files in the `src` folders manually

### 3. Create the object

[](#3-create-the-object)

```
