nitotm/efficient-language-detector
Fast, accurate language detection in pure PHP (mbstring required). No dependencies. Supports 60 languages and multiple database sizes/modes (array/string/bytes/disk) to balance speed vs memory, with performance comparable to C++ detectors.
ELD database new default size is large, and mode string.
Compared with previous array mode, string reduces peak memory up to 35x and memory usage by 30x, enabling larger databases as default with higher accuracy.
large-string has a 50% memory reduction over small-array.
string is only about 2x slower than array, which is still quite fast.
ELD has now database execution modes: array, string, bytes and disk. More Info at README.
Current default, that matches previous execution is array-small. (Small for database size)
In a future version, the new default will be string-large, so I encourage trying it.
v3.1.1 : Composer install fix
Changes from ELD v2 to v3:
detect()->language now returns string 'und' for undetermined instead of NULL
Databases are not compatible, and bigger, medium v2 ≈ small v3
dynamicLangSubset() function is removed
Function cleanText() is now named enableTextCleanup()
Remove files in tests/ misc/ and benchmark/ from the installation when installing the library via composer install --prefer-dist
Added info() function
Return type changed from array to object. Upgraded from PHP 7.3 to 7.4
Code improvements. Fixed LanguageDetector file name.
How can I help you explore Laravel packages today?