{"id":17066778,"url":"https://github.com/tobyzerner/fluent-php","last_synced_at":"2025-03-23T09:44:03.308Z","repository":{"id":82655124,"uuid":"221609626","full_name":"tobyzerner/fluent-php","owner":"tobyzerner","description":null,"archived":false,"fork":false,"pushed_at":"2020-04-25T02:17:26.000Z","size":32,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-28T16:27:44.529Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tobyzerner.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}},"created_at":"2019-11-14T04:12:28.000Z","updated_at":"2021-08-27T12:23:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"3710b40b-2858-4931-9b97-6fce8fc6cc1a","html_url":"https://github.com/tobyzerner/fluent-php","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobyzerner%2Ffluent-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobyzerner%2Ffluent-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobyzerner%2Ffluent-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobyzerner%2Ffluent-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tobyzerner","download_url":"https://codeload.github.com/tobyzerner/fluent-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245084610,"owners_count":20558248,"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":[],"created_at":"2024-10-14T11:08:16.252Z","updated_at":"2025-03-23T09:44:03.284Z","avatar_url":"https://github.com/tobyzerner.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fluent PHP [![Build Status][travisimage]][travislink]\n\n[travisimage]: https://travis-ci.org/tobyz/fluent-php.svg?branch=master\n[travislink]: https://travis-ci.org/tobyz/fluent-php\n\nThis library is a PHP implementation of [Project Fluent][], a localization\nframework designed to unleash the expressive power of the natural language.\n\nIt is a simple port of the official JavaScript [@fluent/bundle][] package with a very similar API and source code architecture. It also includes an overlay utility based on [@fluent/dom][] to allow HTML strings to be translated.\n\n[Project Fluent]: https://projectfluent.org\n[@fluent/bundle]: https://github.com/projectfluent/fluent.js/tree/master/fluent-bundle\n[@fluent/dom]: https://github.com/projectfluent/fluent.js/tree/master/fluent-dom\n\n\n## Installation\n\n    composer install tobyz/fluent-php\n\n\n## Usage\n\n```php\nuse Tobyz\\Fluent\\Bundle;\nuse Tobyz\\Fluent\\Resource;\nuse Tobyz\\Fluent\\Overlay;\n\n$resource = new Resource('\n-brand-name = Foo 3000\nwelcome = Welcome, {$name}, to {-brand-name}!\n');\n\n$bundle = new Bundle('en-US');\n$errors = $bundle-\u003eaddResource($resource);\nif (count($errors)) {\n    // Syntax errors are per-message and don't break the whole resource\n}\n\n$welcome = $bundle-\u003egetMessage('welcome');\nif ($welcome) {\n    $bundle-\u003eformatPattern($welcome['value'], ['name' =\u003e 'Anna']);\n    // → \"Welcome, Anna, to Foo 3000!\"\n}\n\n// Overlay translations and attributes onto HTML\n// See https://github.com/projectfluent/fluent.js/wiki/DOM-Overlays\nOverlay::translateHtml(\n    '\u003cp\u003e\u003cimg data-l10n-name=\"world\" src=\"world.png\"\u003e\u003c/p\u003e',\n    [\n        'value' =\u003e 'Hello, \u003cimg data-l10n-name=\"world\" alt=\"world\"\u003e!', \n        'attributes' =\u003e ['title' =\u003e 'Hello']\n    ]\n);\n// → \u003cp title=\"Hello\"\u003eHello, \u003cimg data-l10n-name=\"world\" alt=\"world\" src=\"world.png\"\u003e!\u003c/p\u003e\n```\n\n\n## Caveats\n\n* There is no PHP implementation of `Intl.PluralRules`. For now a basic \"polyfill\" has been included but it only contains the rule for English cardinals.\n\n* PHP includes the [NumberFormatter][] and [IntlDateFormatter][] classes, but these lack some of the functionality of `Intl.NumberFormat` and `Intl.DateTimeFormat`, and thus the full API for the [built-in functions][] cannot be supported. Specifically:\n\n    * In `NUMBER`, the `currencyDisplay` option is not supported.\n\n    * In `DATETIME`, no options are supported except for `timeZone`. However, the [experimental] `dateStyle` and `timeStyle` options are supported.\n\n* The library currently has no tests.\n\n[NumberFormatter]: https://www.php.net/manual/en/class.numberformatter.php\n[IntlDateFormatter]: https://www.php.net/manual/en/class.intldateformatter.php\n[built-in functions]: https://projectfluent.org/fluent/guide/functions.html\n[experimental]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat#Parameters\n\n\n## Contributing\n\nFluent PHP is open-source, licensed under the Apache License, Version 2.0. Feel free to send pull requests or create issues if you come across problems or have great ideas.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobyzerner%2Ffluent-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftobyzerner%2Ffluent-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobyzerner%2Ffluent-php/lists"}