{"id":22831526,"url":"https://github.com/phrase/phrase-in-context-editor-symfony","last_synced_at":"2026-02-06T17:35:05.421Z","repository":{"id":5675185,"uuid":"6885023","full_name":"phrase/phrase-in-context-editor-symfony","owner":"phrase","description":"Adapter to integrate Phrase into a Symfony2 application","archived":false,"fork":false,"pushed_at":"2025-08-04T12:14:52.000Z","size":381,"stargazers_count":1,"open_issues_count":7,"forks_count":1,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-08-04T15:44:30.861Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://phrase.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"daneden/animate.css","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phrase.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":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2012-11-27T14:44:49.000Z","updated_at":"2025-08-04T12:14:55.000Z","dependencies_parsed_at":"2024-12-12T20:33:52.761Z","dependency_job_id":"f2129736-7f39-46df-b8ad-a340ec822524","html_url":"https://github.com/phrase/phrase-in-context-editor-symfony","commit_stats":null,"previous_names":["phrase/phrase-in-context-editor-symfony"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/phrase/phrase-in-context-editor-symfony","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phrase%2Fphrase-in-context-editor-symfony","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phrase%2Fphrase-in-context-editor-symfony/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phrase%2Fphrase-in-context-editor-symfony/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phrase%2Fphrase-in-context-editor-symfony/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phrase","download_url":"https://codeload.github.com/phrase/phrase-in-context-editor-symfony/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phrase%2Fphrase-in-context-editor-symfony/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29170218,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T16:33:35.550Z","status":"ssl_error","status_checked_at":"2026-02-06T16:33:30.716Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":"2024-12-12T20:26:26.607Z","updated_at":"2026-02-06T17:35:05.413Z","avatar_url":"https://github.com/phrase.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Phrase Strings In-Context Editor for Symfony\n\n**phrase-in-context-editor-symfony** is the official adapter for integrating the [Phrase Strings In-Context Editor](https://support.phrase.com/hc/en-us/articles/5784095916188-In-Context-Editor-Strings) with your Symfony application.\n\n## :scroll: Documentation\n\n### Prerequisites\n\nTo use the In-Context Editor with your application you have to:\n\n* Sign up for a Phrase account: [https://app.phrase.com/signup](https://app.phrase.com/signup)\n* Use the [Symfony](https://symfony.com/) framework for PHP\n\n**Note:** Version 2.0.0 supports Symfony 5 and up, along with a new version of the ICE. If you are using Symfony 2, 3, 4, please [check out to version 1.0.0 and follow the README there](https://github.com/phrase/phrase-in-context-editor-symfony/blob/v1.0.0/README.md).\n\n### Demo\n\nYou can find a demo project in the `demo` folder, just follow [the README.md in that folder](https://github.com/phrase/phrase-in-context-editor-symfony/tree/master/demo) to start up the app and try out the In-Context Editor for Symfony. Feel free to check out the sample code too!\n\n### Installation\n\nFollow these steps to integrate the In-Context Editor with your Symfony application.\n\n1. Copy `PhraseStringsInContextEditor` and its contents from this repository into your repository's `/src/Service` folder or wherever you would like to place it. Make sure to adjust the namespace accordingly if you decide to place it somewhere else.\n\n2. Adjust `config/services.yaml` to decorate the `translator` service with our adapter:\n   ```yaml\n   services:\n       ...\n       App\\Service\\PhraseStringsInContextEditor\\Translator:\n           decorates: translator\n   ```\n\n3. Add this JavaScript snippet to your base or layout Twig template between the `{% block javascripts %}` so the In-Context Editor can read the webpage:\n   ```js\n   \u003cscript\u003e\n       window.PHRASEAPP_CONFIG = {\n           accountId: '0bed59e5',\n           projectId: '00000000000000004158e0858d2fa45c',\n           datacenter: 'eu',\n           origin: 'phrase-symfony',\n       };\n       (function() {\n           var phrasejs = document.createElement('script');\n           phrasejs.type = 'module';\n           phrasejs.async = true;\n           phrasejs.src = 'https://cdn.phrase.com/strings/plugins/editor/latest/ice/index.js'\n           var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(phrasejs, s);\n       })();\n   \u003c/script\u003e\n   ```\n\n    You can find your Project-ID and Account-ID in the Phrase Translation Center.\n\n4. Your application is now connected to the In-Context Editor. Reload your application and login with your Phrase credentials to start the translation process directly on your webpage!\n\n### Development\n\n#### Translate in Symfony with ICE\nAs our adapter is now decorating the translator service, you wTranslate as you would normally would in Symfony:\n\n1. Through the `translator` service's `trans` method, e.g. translating from inside a controller:\n   ```php\n   $translated = $translate-\u003etrans('key_name');\n   ```\n\n2. Through the `trans` filter in a twig template:\n   ```\n   {{ 'key_name'|trans }}\n   ```\n\nSee [Symfony docs on translations](https://symfony.com/doc/current/translation.html) for more details on how to handle translations.\n\n#### Using the old version of ICE\n To use the old version of ICE, add the option `useOldICE: true` to your config in the JavaScript snippet:\n ```js\n window.PHRASEAPP_CONFIG = {\n    accountId: '0bed59e5',\n    projectId: '00000000000000004158e0858d2fa45c',\n    datacenter: 'eu',\n    origin: 'phrase-symfony',\n    useOldICE: true,\n };\n ```\n\n#### Using the US Datacenter with ICE\nIn addition to the settings in your config, set the US datacenter to enable it working with the US endpoints.\n```js\n    datacenter: 'us',\n```\n\n#### Setting the ICE for a Different Environment\nIf you want the ICE running on a different environment instead of `dev`, change the env on Line 12 in the Translator file:\n```php\n# PhraseStringsInContextEditor\\Translator.php\n\n#[When(env: 'dev')]\n```\n\n## :white_check_mark: Commits \u0026 Pull Requests\n\nWe welcome anyone who wants to contribute to our codebase, so if you notice something, feel free to open a Pull Request! However, we ask that you please use the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification for your commit messages and titles when opening a Pull Request.\n\nExample: `chore: Update README`\n\n## :question: Issues, Questions, Support\n\nPlease use [GitHub issues](https://github.com/phrase/Flask-Phrase/issues) to share your problem, and we will do our best to answer any questions or to support you in finding a solution.\n\n## :books: Resources\n\n* [Installing \u0026 Setting Up the Symfony Framework](https://symfony.com/doc/current/setup.html)\n* [Localization Guides and Software Translation Best Practices](http://phrase.com/blog/)\n* [Phrase Help Center](https://support.phrase.com/)\n* [Contact Phrase Team](https://phrase.com/contact)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphrase%2Fphrase-in-context-editor-symfony","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphrase%2Fphrase-in-context-editor-symfony","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphrase%2Fphrase-in-context-editor-symfony/lists"}