Search by

An Internationalization Framework for PHP.

Package info

github.com/richardDobron/fbt

pkg:composer/richarddobron/fbt

Statistics

Installs: 23 147

Dependents: 2

Suggesters: 0

Stars: 15

Open Issues: 0

5.1.0 2026-10-01 21:19 UTC

README

FBT

FBT for PHP

Latest Version on Packagist MIT Licensed Test Status Total Downloads

FBT is an internationalization framework for PHP designed to be not just powerful and flexible, but also simple and intuitive. It helps with the following:

  • Organizing your source text for translation
  • Composing grammatically correct translatable UI
  • Eliminating verbose boilerplate for generating UI

This library is based on the JavaScript implementation of Facebook's FBT and its maintained fork fbtee.

FBT intro

FBT plurals

FBT enum

FBT pronouns

πŸ“– Requirements

  • PHP 7.0 or higher
  • Composer is required for installation

πŸ“¦ Installing

$ composer require richarddobron/fbt:^5

✨ Features

  • Parameters and interpolation
  • Implicit parameters
  • Auto-parameterization
  • Plurals
  • Enumerations
  • Pronouns
  • Lists
  • Number formatting
  • Phrase extracting
  • Inline translating

πŸš€ Getting started

See the Getting Started guide for more.

πŸ“‘ Version Guidance

Version Released Status Repo PHP Version
3.x 2022-02-18 Unsupported v3 >= 7.0
4.x 2022-04-09 Unsupported v4 >= 7.2
5.x 2026-09-25 Latest v5 >= 7.2

πŸ”Œ Official integrations

The following integrations are fully supported and maintained:

Built-in support:

  • Latte: {fbt(...)} is rendered without escaping, and collect-fbts collects the strings of .latte templates (requires latte/latte)

βš™οΈ How FBT works

Like Facebook's fbt, FBT creates tables of all possible variations for each fbt phrase and accesses them at runtime. fbt(...) callsites are compiled from their constructs (e.g. fbt::param()), and <fbt> constructs are parsed via DOM Forge. Each callsite is compiled once, its strings are extracted for translation, and the translated payloads are looked up during execution.

⬆️ Upgrading

See UPGRADE-5.0.md for upgrading from 4.x to 5.0.

πŸ“• Full documentation

βœ… TODO

  • Add driver-agnostic support for multiple database systems.
  • Add integrations for Symfony, CakePHP, Zend Framework, ...
  • ...

🀝 Contributing

Please see CONTRIBUTING for details.

πŸ“œ License

This project is licensed under the MIT License. See the LICENSE file for details.