{"id":16814490,"url":"https://github.com/wickedone/phrase-translation-provider","last_synced_at":"2026-03-07T17:04:23.914Z","repository":{"id":65138420,"uuid":"581992918","full_name":"wickedOne/phrase-translation-provider","owner":"wickedOne","description":"symfony phrase translation provider","archived":false,"fork":false,"pushed_at":"2025-03-18T06:33:19.000Z","size":822,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T13:07:40.721Z","etag":null,"topics":["phrase","symfony","translation-providers"],"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/wickedOne.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"github":["wickedOne"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2022-12-25T07:51:52.000Z","updated_at":"2025-03-18T06:33:22.000Z","dependencies_parsed_at":"2024-03-16T05:21:01.259Z","dependency_job_id":"0c4c7d88-3a4d-4680-8154-f975090722b2","html_url":"https://github.com/wickedOne/phrase-translation-provider","commit_stats":{"total_commits":107,"total_committers":2,"mean_commits":53.5,"dds":"0.36448598130841126","last_synced_commit":"70fa1570e9fc617ec0085853cf2ed40a6fa2c002"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wickedOne%2Fphrase-translation-provider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wickedOne%2Fphrase-translation-provider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wickedOne%2Fphrase-translation-provider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wickedOne%2Fphrase-translation-provider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wickedOne","download_url":"https://codeload.github.com/wickedOne/phrase-translation-provider/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245122790,"owners_count":20564374,"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":["phrase","symfony","translation-providers"],"created_at":"2024-10-13T10:29:35.679Z","updated_at":"2026-03-07T17:04:23.877Z","avatar_url":"https://github.com/wickedOne.png","language":"PHP","funding_links":["https://github.com/sponsors/wickedOne"],"categories":[],"sub_categories":[],"readme":"# phrase-translation-provider\n\nsymfony phrase translation provider bridge\n\n[![infection](https://img.shields.io/endpoint?style=flat\u0026url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2FwickedOne%2Fphrase-translation-provider%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/wickedOne/phrase-translation-provider/master)\n[![codecov](https://codecov.io/gh/wickedOne/phrase-translation-provider/branch/master/graph/badge.svg?token=UHKAVGURP7)](https://codecov.io/gh/wickedOne/phrase-translation-provider)\n[![stable](https://poser.pugx.org/wickedone/phrase-translation-provider/v)](https://packagist.org/packages/wickedone/phrase-translation-provider)\n[![downloads](https://poser.pugx.org/wickedone/phrase-translation-provider/downloads)](https://packagist.org/packages/wickedone/phrase-translation-provider)\n[![license](https://poser.pugx.org/wickedone/phrase-translation-provider/license)](https://packagist.org/packages/wickedone/phrase-translation-provider)\n[![php](https://poser.pugx.org/wickedone/phrase-translation-provider/require/php)](https://packagist.org/packages/wickedone/phrase-translation-provider)\n\n\u003e :warning: this translation provider [has been integrated](https://github.com/symfony/phrase-translation-provider) into symfony starting at version 6.4.\n\u003e this repository will be archived once [lts expires](https://symfony.com/releases/5.4) for symfony 5.4\n\n## installation\n\n```bash\ncomposer require wickedone/phrase-translation-provider\n```\n\n## dsn example\n\n```dotenv\nPHRASE_DSN=phrase://PROJECT_ID:API_TOKEN@default?userAgent=myProject\n```\n\n### dsn elements\n\n- `PROJECT_ID`: can be retrieved in phrase from `project settings \u003e API \u003e Project ID`\n- `API_TOKEN`: can be created in your [phrase profile settings](https://app.phrase.com/settings/oauth_access_tokens)\n- `default`: endpoint, defaults to `api.phrase.com`\n\n### required dsn query parameters\n\n- `userAgent`: please read [this](https://developers.phrase.com/api/#overview--identification-via-user-agent) for some examples.\n\nsee [fine tuning your phrase api calls](#fine-tuning-your-phrase-api-calls) for additional dsn options\n\n## service phrase provider\n\nin your `services.yaml` add the following to enable the phrase provider.\n\n```yaml\nSymfony\\Component\\Translation\\Bridge\\Phrase\\PhraseProviderFactory:\n    tags: ['translation.provider_factory']\n    arguments:\n        $defaultLocale: '%kernel.default_locale%'\n        $loader: '@translation.loader.xliff'\n        $xliffFileDumper: '@translation.dumper.xliff'\n        $cache: '@cache.app'\n```\n\nand in your `translations.yaml` you can add:\n\n```yaml\nframework:\n    translator:\n        providers:\n            phrase:\n                dsn: '%env(PHRASE_DSN)%'\n                domains: ~\n                locales: ~\n```\n\n## phrase locale names\n\ntranslations being imported using the symfony xlf format in phrase, locales are matched on locale name in phrase.\ntherefor it's necessary the locale names should be as defined in [RFC4646](https://www.ietf.org/rfc/rfc4646.txt) (e.g. pt-BR rather than pt_BR).\nnot doing so will result in phrase creating a new locale for the imported keys.\n\n## locale creation\n\nif you define a locale in your `translation.yaml` which is not configured in your phrase project, it will be automatically created. deletion of locales however, is (currently) not managed by this provider.\n\n## domains as tags\n\ntranslations will be tagged in phrase with the symfony translation domain they belong to.\ncheck the [wickedone/phrase-tag-bundle](https://github.com/wickedOne/phrase-tag-bundle) if you need help managing your tags in phrase\n\n## cache\n\nthe read responses from phrase are cached to speed up the read and delete method of this provider.\ntherefor the factory should be initialised with a PSR-6 compatible cache adapter.\n\n## events\n\nto enable you to perform post-processing on translation values and / or keys, two events are dispatched by this provider class.\n\n### PhraseReadEvent\n\n_after_ reading the catalogue from phrase, the resulting `TranslatorBag` is dispatched in a `PhraseReadEvent` prior to being returned from the read method.\n\n### PhraseWriteEvent\n\n_before_ writing the catalogue to phrase, the `TranslatorBag` is dispatched in a `PhraseWriteEvent`.\n\n## fine tuning your phrase api calls\n\nyou can fine tune the read and write methods of this provider by adding query parameters to your dsn configuration.\ngeneral usage is `read|write[option_name]=value`\n\n**example:** `phrase://PROJECT_ID:API_TOKEN@default?read[encoding]=UTF-8\u0026write[update_descriptions]=0`\n\nsee tables below for available options and, if applicable, their default values.\n\n### read\n\nin order to read translations from phrase the [download locale](https://developers.phrase.com/api/#get-/projects/-project_id-/locales/-id-/download) call is made to the phrase api. this call provides the following options.\n\n| name                              |  type  |  default value   | comment                                                                             |\n|-----------------------------------|:------:|:----------------:|-------------------------------------------------------------------------------------|\n| `branch`                          | string |                  |                                                                                     |\n| `include_empty_translations`      |  bool  |        1         |                                                                                     |\n| `exclude_empty_zero_forms`        |  bool  |                  |                                                                                     |\n| `include_translated_keys`         |  bool  |                  |                                                                                     |\n| `keep_notranslate_tags`           |  bool  |                  |                                                                                     |\n| `format_options`                  | array  | enclose_in_cdata |                                                                                     |\n| `encoding`                        | string |                  |                                                                                     |\n| `skip_unverified_translations`    |  bool  |                  |                                                                                     |\n| `include_unverified_translations` |  bool  |                  |                                                                                     |\n| `use_last_reviewed_version`       |  bool  |                  |                                                                                     |\n| `fallback_locale_enabled`         |  bool  |        0         | when the fallback locale is enabled, caching responses from phrase will be disabled |\n\n### write\n\nin order to write translations to phrase the [upload](https://developers.phrase.com/api/#post-/projects/-project_id-/uploads) call is made to the phrase api. this call provides the following options.  \n\n| name                  |  type  | default value | comment |\n|-----------------------|:------:|:-------------:|---------|\n| `update_translations` |  bool  |       1       |         |\n| `update_descriptions` |  bool  |               |         |\n| `skip_upload_tags`    |  bool  |               |         |\n| `skip_unverification` |  bool  |               |         |\n| `file_encoding`       | string |               |         |\n| `locale_mapping`      | array  |               |         |\n| `format_options`      | array  |               |         |\n| `autotranslate`       |  bool  |               |         |\n| `mark_reviewed`       |  bool  |               |         |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwickedone%2Fphrase-translation-provider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwickedone%2Fphrase-translation-provider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwickedone%2Fphrase-translation-provider/lists"}