Download the PHP package bermudaphp/polyglot without Composer

On this page you can find all versions of the php package bermudaphp/polyglot. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package polyglot

Polyglot

PHP Version Require GitHub Tests Code Coverage Latest Version on Packagist License: MIT

Polyglot is a powerful, flexible internationalization (i18n) and localization (l10n) library for PHP 8.4+ applications with support for ICU message formatting, pluralization, caching, and more.

Read documentation in Russian (Документация на русском)

Table of Contents

Installation

Basic Usage

Key Concepts

Polyglot uses several core concepts:

Creating a Translator

The simplest way to create a translator is using the factory:

For more control, you can create components manually:

Locales

Polyglot provides multiple ways to handle locale codes:

  1. As simple strings ('en', 'en_US', 'fr_FR')
  2. Using the LocaleEnum typed enum
  3. Using the Locale value object

LocaleEnum

Locale Value Object

Translation Files

Polyglot supports multiple formats for translation files:

PHP Array Files

JSON Files

Accessing Nested Keys

Nested keys can be accessed using dot notation:

Pluralization

Polyglot provides robust support for pluralization based on the CLDR (Common Locale Data Repository) rules:

ICU Message Format

Polyglot supports the ICU (International Components for Unicode) message format, a powerful standard for handling translations with variables, pluralization, and more.

Parameter Substitution

Number Formatting

Date Formatting

Plural Formatting

Select Formatting

Nested Formatting

Message Builders

Polyglot provides a set of builders to programmatically create ICU message templates.

ICU Message Builder

Plural Builder

Select Builder

Caching

Polyglot supports caching of loaded translations to improve performance:

Also included is an InMemoryCache for simple use cases:

Locale Detection

Polyglot can automatically detect the user's preferred locale:

PSR-15 Middleware

Polyglot includes a PSR-15 middleware for detecting the locale from HTTP requests:

The middleware:

  1. Detects the locale from the request
  2. Sets it in the I18n instance
  3. Adds the locale as a request attribute
  4. Passes control to the next middleware

License

The Polyglot library is open-sourced software licensed under the MIT license.


All versions of polyglot with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
psr/http-message Version ^1.0|^2.0
psr/http-server-middleware Version ^1.0
psr/simple-cache Version ^1.0|^2.0|^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bermudaphp/polyglot contains the following files

Loading the files please wait ....