Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Language Detector

Language Detector Laravel Package

vluzrmos/language-detector

Laravel package for detecting the language of text strings through a simple API. It includes a service provider, facade, and configuration, making it easy to identify languages for localization, validation, or routing decisions with minimal setup.

View on GitHub
Deep Wiki
Context7

vluzrmos/language-detector is a lightweight Laravel package for identifying the language of arbitrary text. It integrates cleanly with Laravel’s service container and facade, making it easy to add language detection to localization, routing, content filtering, or analytics workflows.

  • Simple API through the LanguageDetector facade.
  • Configurable detection backend and supported language list.
  • Handles both short and long text inputs.
  • Laravel-native configuration and service provider.
  • Returns language codes ready for localization workflows.
Frequently asked questions about Language Detector
How do I install vluzrmos/language-detector in a Laravel app?
Install it with Composer using composer require vluzrmos/language-detector, then register the package service provider if your Laravel version does not auto-discover it. Add the locale-detection middleware to the appropriate HTTP or route group and publish any configuration the README documents. Verify the package's Composer constraints against your Laravel and PHP versions before adding it to a shared codebase.
Which Laravel and PHP versions are supported by this package?
The overview does not list exact Laravel or PHP constraints, so check the package's composer.json and README before adoption. The package has low adoption and no dependents, so broad compatibility across current Laravel releases is not well evidenced. Run a short compatibility spike on your target Laravel and PHP versions, including route caching if you use it.
How does browser preference language detection work in Laravel?
The package can resolve a locale from the browser's Accept-Language preferences before Laravel's localization layer runs. You should confirm how it ranks quality values and handles multiple languages by checking the source or README. Keep Laravel's fallback locale configured as the final fallback when no supported browser locale matches.
Can this package detect language from subdomains or route prefixes?
Yes, the package overview lists browser preferences, subdomains, and route prefixes as supported detection strategies. Subdomain detection adds DNS, TLS certificate, and routing concerns, so test it in staging before production. Route-prefix detection changes URL structure and may affect SEO and redirects, so plan those separately.
How do I detect the language of a string with the language detector facade?
The package provides a facade and a straightforward API for identifying languages in strings, but the overview does not document exact method names. Read the README or facade class for the supported detect methods and return values. Wrap the call behind your own service if you need to swap the implementation later.
Is vluzrmos/language-detector compatible with Laravel route caching and Octane?
Compatibility with route caching and Laravel Octane is not evidenced in the package overview. Middleware that resolves locale at request time can work under Octane, but you must verify that no request state leaks between workers. Test with route:cache enabled and in an Octane environment before relying on it in production.
Does this package conflict with mcamara/laravel-localization?
The package is a small locale resolver, while mcamara/laravel-localization provides broader localization routing features, so overlapping middleware is a real risk. The overview does not confirm compatibility or a recommended integration path. Test middleware order and URL generation carefully, or use only one package for locale resolution.
What happens when the detected language is unsupported?
The package overview does not specify its behavior for unsupported or malformed locales, so verify this in a spike. A safe setup keeps Laravel's fallback locale as the final resolver and ignores unknown values. Also test malformed Accept-Language headers and locales outside your configured allowlist.
Can I use the language detection logic without the middleware?
The package exposes detection through a service provider and facade, so the underlying resolver may be usable independently of the HTTP middleware. The overview does not guarantee a standalone API, so check the source or README before designing around it. If it is tightly coupled, copy or wrap only the detection logic behind your own interface.
Is vluzrmos/language-detector production-ready and actively maintained?
The package has around 109 GitHub stars, zero dependents, and a single-maintainer profile, which suggests limited ecosystem validation. That does not mean it is unusable, but treat it as a candidate for vendoring or abstraction rather than a strategic dependency. Check the license, test coverage, recent commits, and maintainer responsiveness before production adoption.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent
sierratecnologia/media-manager