PHPackages                             rnr1721/multilingual-core - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. rnr1721/multilingual-core

ActiveLibrary[HTTP &amp; Networking](/categories/http)

rnr1721/multilingual-core
=========================

Core package for multilingual support across different PHP frameworks

1.0.2(1y ago)0111MITPHPPHP ^8.1

Since Dec 8Pushed 1y ago1 watchersCompare

[ Source](https://github.com/rnr1721/multilingual-core)[ Packagist](https://packagist.org/packages/rnr1721/multilingual-core)[ RSS](/packages/rnr1721-multilingual-core/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (6)Versions (5)Used By (1)

Multilingual Core Package
=========================

[](#multilingual-core-package)

This package provides core functionality for implementing multilingual support across different PHP frameworks. It serves as a base dependency for framework-specific implementations.

Features:
---------

[](#features)

- Framework-agnostic multilingual support
- PSR-7 compatible
- Simple language switching via URL prefixes
- Support for RTL languages
- Flexible language detection strategies
- Framework-independent locale management

Requirements:
-------------

[](#requirements)

- PHP 8.1 or higher
- PSR-7 HTTP Message implementation
- PSR-15 HTTP Middleware
- PSR-11 Container

Installation:
-------------

[](#installation)

```
composer require rnr1721/multilingual-core
```

Usage:
------

[](#usage)

This package is not intended to be used directly. Instead, use one of the framework-specific implementations:

- rnr1721/multilingual-laravel for Laravel
- rnr1721/multilingual-symfony for Symfony
- rnr1721/multilingual-slim for Slim Framework

For Framework Implementation Developers: The core package provides several interfaces and base classes:

### LanguageInterface - Represents a language with its properties:

[](#languageinterface---represents-a-language-with-its-properties)

- getCode() - returns language code (e.g., 'en', 'ru')
- getName() - returns language name
- getLocale() - returns locale code (e.g., 'en\_US')
- isRtl() - indicates if language is RTL

### LanguageManagerInterface - Manages available languages:

[](#languagemanagerinterface---manages-available-languages)

- getDefaultLanguage()
- getCurrentLanguage()
- setCurrentLanguage()
- getAvailableLanguages()
- hasLanguage()
- getLanguage()

### LanguageDetectorInterface - Detects current language from request

[](#languagedetectorinterface---detects-current-language-from-request)

### UrlGeneratorInterface - Generates URLs with language prefixes

[](#urlgeneratorinterface---generates-urls-with-language-prefixes)

### LocaleManagerInterface - Framework-specific locale management:

[](#localemanagerinterface---framework-specific-locale-management)

- setLocale() - sets the application locale in framework-specific way

Implementation example
----------------------

[](#implementation-example)

```
// Create language instances
$languages = [
    new Language('en', 'English', 'en_US'),
    new Language('ru', 'Russian', 'ru_RU', false)
];

// Implement LocaleManagerInterface for your framework
class MyFrameworkLocaleManager implements LocaleManagerInterface
{
    public function setLocale(string $locale): void
    {
        // Framework-specific locale setting
    }
}

// Create language manager
$manager = new LanguageManager(
    new MyFrameworkLocaleManager(),
    $languages,
    'en' // default language
);

// Language switching example
$manager->setCurrentLanguage('ru'); // Will also set framework locale to ru_RU
```

Testing:
--------

[](#testing)

```
composer test
```

Code Style:
-----------

[](#code-style)

```
composer cs-check
composer cs-fix
```

Static Analysis:
----------------

[](#static-analysis)

```
composer phpstan
```

License: MIT

Contributing:
-------------

[](#contributing)

Feel free to submit issues and pull requests. For detailed documentation on implementing framework-specific packages, see the examples in our official implementations.

Note: This is a core package and should be used as a dependency for framework-specific implementations rather than directly in projects.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance42

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~3 days

Total

3

Last Release

509d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b056f4160d8f9302378726a35860b42bfa67c29760bb55fcacddfde2bfa6f6ac?d=identicon)[rnr1721](/maintainers/rnr1721)

---

Top Contributors

[![rnr1721](https://avatars.githubusercontent.com/u/122087344?v=4)](https://github.com/rnr1721 "rnr1721 (9 commits)")

---

Tags

psr-7phplocalizationi18nlanguagemultilingualframework agnostic

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/rnr1721-multilingual-core/health.svg)

```
[![Health](https://phpackages.com/badges/rnr1721-multilingual-core/health.svg)](https://phpackages.com/packages/rnr1721-multilingual-core)
```

###  Alternatives

[mezzio/mezzio-authentication-oauth2

OAuth2 (server) authentication middleware for Mezzio and PSR-7 applications.

28483.0k2](/packages/mezzio-mezzio-authentication-oauth2)[mezzio/mezzio-authentication

Authentication middleware for Mezzio and PSR-7 applications

121.6M26](/packages/mezzio-mezzio-authentication)[openswoole/core

Openswoole core library

181.1M31](/packages/openswoole-core)[httpsoft/http-runner

Running PSR-7 components and building PSR-15 middleware pipelines

1455.0k5](/packages/httpsoft-http-runner)[jimtools/jwt-auth

PSR-15 JWT Authentication middleware, A replacement for tuupola/slim-jwt-auth

20142.3k3](/packages/jimtools-jwt-auth)[genkgo/archive-stream

Stream a ZIP file (memory efficient) as a PSR-7 message

3063.0k](/packages/genkgo-archive-stream)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
