{"id":14966440,"url":"https://github.com/yiisoft/translator-message-php","last_synced_at":"2025-10-19T09:31:27.230Z","repository":{"id":39906351,"uuid":"180008598","full_name":"yiisoft/translator-message-php","owner":"yiisoft","description":"Yii i18n PHP message storage","archived":false,"fork":false,"pushed_at":"2024-04-04T05:21:30.000Z","size":130,"stargazers_count":13,"open_issues_count":1,"forks_count":8,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-04-13T23:52:53.700Z","etag":null,"topics":["hacktoberfest","i18n","yii3"],"latest_commit_sha":null,"homepage":"https://www.yiiframework.com/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yiisoft.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"open_collective":"yiisoft","github":["yiisoft"]}},"created_at":"2019-04-07T18:47:56.000Z","updated_at":"2023-11-28T05:04:20.000Z","dependencies_parsed_at":"2024-02-20T22:04:17.366Z","dependency_job_id":"babf585c-bf70-44c3-a9f3-24ee9bca2542","html_url":"https://github.com/yiisoft/translator-message-php","commit_stats":{"total_commits":102,"total_committers":16,"mean_commits":6.375,"dds":0.5490196078431373,"last_synced_commit":"6667286e4759e5b024b553ee55caa48ba9453ad5"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Ftranslator-message-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Ftranslator-message-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Ftranslator-message-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Ftranslator-message-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yiisoft","download_url":"https://codeload.github.com/yiisoft/translator-message-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":218465528,"owners_count":16335211,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["hacktoberfest","i18n","yii3"],"created_at":"2024-09-24T13:36:23.412Z","updated_at":"2025-10-19T09:31:27.224Z","avatar_url":"https://github.com/yiisoft.png","language":"PHP","funding_links":["https://opencollective.com/yiisoft","https://github.com/sponsors/yiisoft"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/yiisoft\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://yiisoft.github.io/docs/images/yii_logo.svg\" height=\"100px\" alt=\"Yii\"\u003e\n    \u003c/a\u003e\n    \u003ch1 align=\"center\"\u003eYii Translator PHP Message Storage\u003c/h1\u003e\n    \u003cbr\u003e\n\u003c/p\u003e\n\n[![Latest Stable Version](https://poser.pugx.org/yiisoft/translator-message-php/v)](https://packagist.org/packages/yiisoft/translator-message-php)\n[![Total Downloads](https://poser.pugx.org/yiisoft/translator-message-php/downloads)](https://packagist.org/packages/yiisoft/translator-message-php)\n[![Build status](https://github.com/yiisoft/translator-message-php/workflows/build/badge.svg)](https://github.com/yiisoft/translator-message-php/actions?query=workflow%3Abuild)\n[![Code Coverage](https://codecov.io/gh/yiisoft/translator-message-php/branch/master/graph/badge.svg)](https://codecov.io/gh/yiisoft/translator-message-php)\n[![Mutation testing badge](https://img.shields.io/endpoint?style=flat\u0026url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fyiisoft%2Ftranslator-message-php%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/yiisoft/translator-message-php/master)\n[![static analysis](https://github.com/yiisoft/translator-message-php/workflows/static%20analysis/badge.svg)](https://github.com/yiisoft/translator-message-php/actions?query=workflow%3A%22static+analysis%22)\n[![type-coverage](https://shepherd.dev/github/yiisoft/translator-message-php/coverage.svg)](https://shepherd.dev/github/yiisoft/translator-message-php)\n\nThe package provides message storage backend based on PHP arrays to be used with [`yiisoft/translator`](https://github.com/yiisoft/translator) package.\n\n## Requirements\n\n- PHP 8.0 or higher.\n\n## Installation\n\nThe package could be installed with [Composer](https://getcomposer.org):\n\n```shell\ncomposer require yiisoft/translator-message-php\n```\n\n## General usage\n\nThe package is meant to be used with [`yiisoft/translator`](https://github.com/yiisoft/translator):\n\n```php\nuse Yiisoft\\Translator\\CategorySource;\nuse Yiisoft\\Translator\\IntlMessageFormatter;\nuse Yiisoft\\Translator\\Message\\Php\\MessageSource;\n\n$categorySource = new CategorySource(\n    'my-category',\n    new MessageSource('/path/to/messages'),\n    new IntlMessageFormatter(),\n);\n```\n\nThe examples below are about using it separately.\n\n### Create an instance of message source\n\n```php\n/** @var string $path - full path to your translations */\n$messageSource = new \\Yiisoft\\Translator\\Message\\Php\\MessageSource($path);\n```\n\n### Read a message without `yiisoft/translator` package\n\n```php\n/** \n * @var \\Yiisoft\\Translator\\Message\\Php\\MessageSource $messageSource\n * @var ?string $translatedString\n */\n$id = 'messageIdentifier';\n$category = 'messageCategory';\n$language = 'de-DE';\n\n$translatedString = $messageSource-\u003egetMessage($id, $category, $language);\n```\n\n### Write an array of messages to storage\n\n```php\n/** \n * @var \\Yiisoft\\Translator\\Message\\Php\\MessageSource $messageSource\n */\n$category = 'messageCategory';\n$language = 'de-DE';\n$data = [\n    'test.id1' =\u003e [\n        'message' =\u003e 'Nachricht 1', // translated string\n        'comment' =\u003e 'Comment for message 1', // is optional parameter for save extra metadata\n    ],\n    'test.id2' =\u003e [\n        'message' =\u003e 'Nachricht 2',\n    ],\n    'test.id3' =\u003e [\n        'message' =\u003e 'Nachricht 3',\n    ],\n];\n\n$messageSource-\u003ewrite($category, $language, $data);\n```\n\nThe following structure will be created after writing:\n\n```\n📁 path_to_your_storage\n  📁 de-DE\n     🗎 messageCategory.php\n```\n\n## Documentation\n\n- [Internals](docs/internals.md)\n\nIf you need help or have a question, the [Yii Forum](https://forum.yiiframework.com/c/yii-3-0/63) is a good place for that.\nYou may also check out other [Yii Community Resources](https://www.yiiframework.com/community).\n\n## License\n\nThe Yii Translator PHP Message Storage is free software. It is released under the terms of the BSD License.\nPlease see [`LICENSE`](./LICENSE.md) for more information.\n\nMaintained by [Yii Software](https://www.yiiframework.com/).\n\n## Support the project\n\n[![Open Collective](https://img.shields.io/badge/Open%20Collective-sponsor-7eadf1?logo=open%20collective\u0026logoColor=7eadf1\u0026labelColor=555555)](https://opencollective.com/yiisoft)\n\n## Follow updates\n\n[![Official website](https://img.shields.io/badge/Powered_by-Yii_Framework-green.svg?style=flat)](https://www.yiiframework.com/)\n[![Twitter](https://img.shields.io/badge/twitter-follow-1DA1F2?logo=twitter\u0026logoColor=1DA1F2\u0026labelColor=555555?style=flat)](https://twitter.com/yiiframework)\n[![Telegram](https://img.shields.io/badge/telegram-join-1DA1F2?style=flat\u0026logo=telegram)](https://t.me/yii3en)\n[![Facebook](https://img.shields.io/badge/facebook-join-1DA1F2?style=flat\u0026logo=facebook\u0026logoColor=ffffff)](https://www.facebook.com/groups/yiitalk)\n[![Slack](https://img.shields.io/badge/slack-join-1DA1F2?style=flat\u0026logo=slack)](https://yiiframework.com/go/slack)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyiisoft%2Ftranslator-message-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyiisoft%2Ftranslator-message-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyiisoft%2Ftranslator-message-php/lists"}