New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

oneofftech/laravel-language-recognizer

Recognize language in text
20,043
Install
composer require oneofftech/laravel-language-recognizer
Latest Version:v0.2.1
PHP:^8.2
Laravel:10 · 11 · 12
Older releases:9
License:MIT
Last Updated:Feb 24, 2025
Links: GitHub  ·  Packagist
Maintainer: OneOffAdmins

Laravel Language Recognizer

Latest Version on Packagist Unit tests badge Total Downloads

Recognize the language in which a text is written.

Language Recognizer for Laravel is a package providing various drivers to recognize the language of a given text.

Currently two drivers are offered:

  • A local binary application
  • A DeepL based one

Installation

You can install the package via composer:

composer require oneofftech/laravel-language-recognizer

You can publish the config file with:

php artisan vendor:publish --provider="Oneofftech\LaravelLanguageRecognizer\LaravelLanguageRecognizerServiceProvider" --tag="laravel-language-recognizer-config"

If you change the path to the Franc binary, as configured in the local driver, ensure that the file is moved or present in that location. You can run php artisan language-recognizer:install-local-driver to download the binary in the configured location

The configuration file allows to configure the driver parameter for performing the language recognition.

Driver pre-requisites

Local Driver

The language recognition, when performed using the local driver, is done using the Franc library, in particular a packaged version in form on an executable.

To download the executable version run:

php artisan language-recognizer:install-local-driver

DeepL Driver

The DeepL driver requires a valid API key. You can obtain a free key on deepl.com.

After obtaining the key specifiy it via the LANGUAGE_RECOGNIZER_DEEPL_KEY environment variable.

Usage

use Oneofftech\LaravelLanguageRecognizer\Support\Facades\LanguageRecognizer;

LanguageRecognizer::recognize('Which language is used in this string!');

Testing

A test suite is available. To execute the tests run:

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

Related Packages

akaunting/laravel-language

Language switcher package for Laravel

364,900 223
dskripchenko/laravel-translatable

Dynamic Language Translation

6,967 0
michele-angioni/multi-language

A Laravel package to handle multi language localization.

6,616 11
agenter-labs/laravel-language

Language switcher package for Laravel

2,851 0
generalsystemsvehicle/in-one-ear

A system for presenting languages (in English), their short and long ISO names a...

1,761 0

Version History

Version Released PHP Laravel License
v0.2.1 ^8.2 ^10.0|^11.0|^12.0 MIT
v0.2.0 ^8.0 ^10.0|^11.0 MIT
v0.1.0 ^8.0 ^9.12|^10.0 MIT