{"id":43863931,"url":"https://github.com/davidlienhard/i18n","last_synced_at":"2026-02-06T11:02:39.873Z","repository":{"id":36983961,"uuid":"312182607","full_name":"davidlienhard/i18n","owner":"davidlienhard","description":"🐘 php library to use for internationalization","archived":false,"fork":false,"pushed_at":"2025-12-13T08:01:45.000Z","size":214,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-14T22:12:56.436Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidlienhard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-11-12T06:02:36.000Z","updated_at":"2025-12-13T08:01:48.000Z","dependencies_parsed_at":"2025-10-02T13:18:09.986Z","dependency_job_id":null,"html_url":"https://github.com/davidlienhard/i18n","commit_stats":{"total_commits":162,"total_committers":3,"mean_commits":54.0,"dds":"0.33333333333333337","last_synced_commit":"6cae9583b5099981696a0d9ce07e922ba496f339"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/davidlienhard/i18n","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidlienhard%2Fi18n","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidlienhard%2Fi18n/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidlienhard%2Fi18n/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidlienhard%2Fi18n/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidlienhard","download_url":"https://codeload.github.com/davidlienhard/i18n/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidlienhard%2Fi18n/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29158564,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T07:18:23.844Z","status":"ssl_error","status_checked_at":"2026-02-06T07:13:32.659Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-02-06T11:02:39.144Z","updated_at":"2026-02-06T11:02:39.850Z","avatar_url":"https://github.com/davidlienhard.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# davidlienhard/i18n\n🐘 php library to use for internationalization\n\n[![Latest Stable Version](https://img.shields.io/packagist/v/davidlienhard/i18n.svg?style=flat-square)](https://packagist.org/packages/davidlienhard/i18n)\n[![Source Code](https://img.shields.io/badge/source-davidlienhard/i18n-blue.svg?style=flat-square)](https://github.com/davidlienhard/i18n)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://github.com/davidlienhard/i18n/blob/master/LICENSE)\n[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%208.0-8892BF.svg?style=flat-square)](https://php.net/)\n[![CI Status](https://github.com/davidlienhard/i18n/actions/workflows/check.yml/badge.svg)](https://github.com/davidlienhard/i18n/actions/workflows/check.yml)\n\n## Setup\n\nYou can install through `composer` with:\n\n```\ncomposer require davidlienhard/i18n:^2\n```\n\n*Note: davidlienhard/i18n requires PHP 8.0*\n\n## How to use\n\n### 1. Create language files\nCreate at least one language file. Supported filetypes are `json`, `yaml`, `yml` or `ini`.\n\n`./lang/en.yml` (English)\n```yml\nsave: Save\ngreeting: Hi %1\n```\n\n`./lang/de.yml` (German)\n```yml\nsave: Speichern\ngreeting: Hallo %1\n```\n\n### 2. Load the class\nUse composer autoloader if possible or include the files in the `src` folders manually\n\n### 3. Create the object\n```php\n\u003c?php declare(strict_types=1);\n\nuse DavidLienhard\\i18n\\i18n;\n\n$i18n = new i18n;\n```\n\n### 4. Set the options\nyou can either set some options right through the constructor or via the set methods\n```php\n$i18n = new i18n(\n    filePath: \"./lang/{LANGUAGE}.yml\",\n    cachePath: \"./cache/\",\n    fallbackLang: \"en\",\n    prefix: \"L\"\n);\n\n$i18n-\u003esetNamespace(\"YourApp\\Translations\");\n```\n\nThe following setter methods are available:\n - `setFilePath(string $filePath)`: Sets the path to the language files\n - `setCachePath(string $cachePath)`: Sets the path to the cache directory\n - `setFallbackLang(string $fallbackLang)`: sets a fallback language\n - `setMergeFallback(bool $mergeFallback)`: whether or not to merge the fallback language\n - `setPrefix(string $prefix)`: Sets the prefix/name of the class to contain the translations\n - `setForcedLang(string $forcedLang)`: a language that is forced to be used\n - `setSectionSeparator(string $sectionSeparator)`: the character to use to concatenate sections\n\n### 5. Initialize the class / create cache-files\n```php\n$i18n-\u003einit();\n```\n\nThss will then create the cache file if required and load the new translation data with the given namespace \u0026 prefix/class-name.\n\n### 6. Use the translation data\n```php\nuse YourApp\\Translations\\L;\n\necho L::save;                       // Save / Speichern\necho L::get(\"save\");                // Save / Speichern\necho L::greeting(\"David\");          // Hi David // Hallo David\necho L::get(\"greeting\", \"David\");   // Hi David // Hallo David\n```\n\n## License\n\nThe MIT License (MIT). Please see [LICENSE](https://github.com/davidlienhard/i18n/blob/master/LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidlienhard%2Fi18n","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidlienhard%2Fi18n","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidlienhard%2Fi18n/lists"}