PHPackages                             detectlanguage/detectlanguage - 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. [API Development](/categories/api)
4. /
5. detectlanguage/detectlanguage

ActiveLibrary[API Development](/categories/api)

detectlanguage/detectlanguage
=============================

Language Detection API PHP Client

v3.0.0(9mo ago)50736.4k—2.1%141MITPHPPHP &gt;=5.3.0CI passing

Since Oct 19Pushed 9mo ago3 watchersCompare

[ Source](https://github.com/detectlanguage/detectlanguage-php)[ Packagist](https://packagist.org/packages/detectlanguage/detectlanguage)[ Docs](https://github.com/detectlanguage/detectlanguage-php)[ RSS](/packages/detectlanguage-detectlanguage/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (7)Used By (1)

Detect Language API PHP Client
==============================

[](#detect-language-api-php-client)

[![PHP version](https://camo.githubusercontent.com/fd41ca8f05ccc4bd9f2e152a4262b761312b8f6578d2c3749cc9bdc67452410e/68747470733a2f2f62616467652e667572792e696f2f70682f6465746563746c616e67756167652532466465746563746c616e67756167652e737667)](https://badge.fury.io/ph/detectlanguage%2Fdetectlanguage)[![Build Status](https://github.com/detectlanguage/detectlanguage-php/actions/workflows/main.yml/badge.svg)](https://github.com/detectlanguage/detectlanguage-php/actions)

Detects language of the given text. Returns detected language codes and scores.

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

[](#installation)

There are two ways to install:

### Require Library

[](#require-library)

```
require_once("/path/to/lib/detectlanguage.php");
```

### Or via [Composer](http://getcomposer.org/):

[](#or-via-composer)

Create or add the following to composer.json in your project root:

```
{
    "require": {
        "detectlanguage/detectlanguage": "*"
    }
}
```

Upgrading
---------

[](#upgrading)

When upgrading please check [changelog](CHANGELOG.md) for breaking changes.

Usage
-----

[](#usage)

### Configuration

[](#configuration)

Before using Detect Language API client you have to setup your personal API key. You can get it by signing up at

```
use \DetectLanguage\DetectLanguage;

DetectLanguage::setApiKey("YOUR API KEY");
```

### Detect language

[](#detect-language)

```
$results = DetectLanguage::detect("Dolce far niente");
```

#### Results

[](#results)

```
Array
(
    [0] => stdClass Object
        (
            [language] => it
            [score] => 0.5074
        )

)
```

### Detect single code

[](#detect-single-code)

If you need just a language code you can use `detectCode`. It returns just the language code.

```
$languageCode = DetectLanguage::detectCode("Dolce far niente");
```

#### Result

[](#result)

```
"it"
```

### Batch detection

[](#batch-detection)

It is possible to detect language of several texts with one request. This method is faster than doing one request per text. To use batch detection just pass array of texts to `detectBatch` method.

```
$results = DetectLanguage::detectBatch(array("Dolce far niente", "Hello world"));
```

#### Results

[](#results-1)

Result is array of detections in the same order as the texts were passed.

```
Array
(
    [0] => Array
        (
            [0] => stdClass Object
                (
                    [language] => it
                    [score] => 0.5074
                )

        )

    [1] => Array
        (
            [0] => stdClass Object
                (
                    [language] => en
                    [score] => 0.9098
                )

        )

)
```

### Get your account status

[](#get-your-account-status)

```
$results = DetectLanguage::getStatus();
```

#### Result

[](#result-1)

```
stdClass Object
(
    [date] => 2013-10-19
    [requests] => 1680
    [bytes] => 21800
    [plan] => FREE
    [plan_expires] =>
    [daily_requests_limit] => 5000
    [daily_bytes_limit] => 1048576
    [status] => ACTIVE
)
```

### Get list of supported languages

[](#get-list-of-supported-languages)

```
$results = DetectLanguage::getLanguages();
```

#### Result

[](#result-2)

```
Array
(
    [0] => stdClass Object
        (
            [code] => aa
            [name] => Afar
        )

    [1] => stdClass Object
        (
            [code] => ab
            [name] => Abkhazian
        )
    ...
```

License
-------

[](#license)

Detect Language API Client is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance58

Moderate activity, may be stable

Popularity51

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 94% 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 ~864 days

Recently: every ~1009 days

Total

6

Last Release

271d ago

Major Versions

v2.2.1 → v3.0.02025-08-20

### Community

Maintainers

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

---

Top Contributors

[![laurynas](https://avatars.githubusercontent.com/u/130315?v=4)](https://github.com/laurynas "laurynas (47 commits)")[![rvanlaak](https://avatars.githubusercontent.com/u/2707563?v=4)](https://github.com/rvanlaak "rvanlaak (2 commits)")[![thomascorthals](https://avatars.githubusercontent.com/u/12425704?v=4)](https://github.com/thomascorthals "thomascorthals (1 commits)")

---

Tags

detect-languagelanguage-detectionapiclientlanguagedetectiondetect

### Embed Badge

![Health badge](/badges/detectlanguage-detectlanguage/health.svg)

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

###  Alternatives

[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k22.6M232](/packages/openai-php-client)[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[google-gemini-php/laravel

Google Gemini PHP for Laravel is a supercharged PHP API client that allows you to interact with the Google Gemini AI API

614397.1k4](/packages/google-gemini-php-laravel)[mozex/anthropic-laravel

Anthropic PHP for Laravel is a supercharged PHP API client that allows you to interact with the Anthropic API

71226.4k1](/packages/mozex-anthropic-laravel)[mozex/anthropic-php

Anthropic PHP is a supercharged community-maintained PHP API client that allows you to interact with Anthropic API.

46365.1k13](/packages/mozex-anthropic-php)[google-gemini-php/symfony

Symfony Bundle for Gemini

149.4k1](/packages/google-gemini-php-symfony)

PHPackages © 2026

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