PHPackages                             aozen/language-detector - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. aozen/language-detector

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

aozen/language-detector
=======================

This package provides a set of functions to detect and manipulate language-specific strings, including language detection, case conversion, and language-based filtering.

v1.0.0(3y ago)035MITPHP

Since Feb 5Pushed 3y ago1 watchersCompare

[ Source](https://github.com/aozen/language-detector)[ Packagist](https://packagist.org/packages/aozen/language-detector)[ Docs](https://github.com/aozen/language-detector)[ RSS](/packages/aozen-language-detector/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Language Detector
=================

[](#language-detector)

Used to determine which language a given string belongs to.

Installation
------------

[](#installation)

You can install the package via composer: `composer require aozen/language-detector`

Usage
-----

[](#usage)

The LanguageDetector class must be included by yourself.

```
    use \Aozen\LanguageDetector\LanguageDetector;
```

Example:

```
class YourClass {
    public function yourFunction() {
        $language_detector = new LanguageDetector();
        return $language_detector->detect("Güneş")->getLanguage(); // Result: "tr"
    }
}
```

Other Usage Examples
--------------------

[](#other-usage-examples)

1. By default, the code searches in all languages specified as `available` within the code.
2. The `getClosestLanguage` function works similarly to `getLanguage`, but it doesn't guarantee a 100% correct result. For instance, the example `Äpfel straße délicieux` would return `invalid_language` with `getLanguage`, while `getClosestLanguage` would return `de`, based on which language had the most character matches. For instance, the expression `délicieux délicieux Äpfel` would have also returned `fr`.
3. To search only in the desired languages, `checkList` is used.

```
    $language_detector->detect("Äpfel")->checkList("tr", "de", "it")->getLanguage(); // de
```

1. To prevent searching in unwanted languages, `blockList` is used.

```
    $language_detector->detect("Äpfel")->blockList("de")->getLanguage(); // invalid_language
```

1. To retrieve the `lowercase` version of the given string for each language, `getLowerCase` is used. Separate definitions for each language are required.

```
    $language_detector->detect("TÜRKÇE-BİR-YAZI")->getLowerCase(); // türkçe-bi̇r-yazı
```

Testing
-------

[](#testing)

`vendor/bin/phpunit tests/Test.php`

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

1244d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5b49826ec500f30a43d14359b7fde2723d999e700ef8c57414b9809450cd0886?d=identicon)[aozn](/maintainers/aozn)

---

Tags

language detectoraozen

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aozen-language-detector/health.svg)

```
[![Health](https://phpackages.com/badges/aozen-language-detector/health.svg)](https://phpackages.com/packages/aozen-language-detector)
```

###  Alternatives

[nitotm/efficient-language-detector

Fast and accurate natural language detection. Detector written in PHP. Nito-ELD, ELD.

63352.8k10](/packages/nitotm-efficient-language-detector)[ideea/language-detector

Detect languages by text

334.4k](/packages/ideea-language-detector)[pmaslak/php-obfuscator

PHP obfuscator

232.6k](/packages/pmaslak-php-obfuscator)

PHPackages © 2026

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