PHP Classes

PHP Language Detection Library: Detect the language of a text using APILayer

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 137 This week: 1All time: 9,240 This week: 560Up
Version License PHP version Categories
langlayer 1.0GNU General Publi...5Localization, PHP 5, Web services
Description 

Author

This class can detect the language of a text using APILayer.

It can send a HTTP request to the APILayer API Web server to detect the language of a given text string.

The class retrieves and decodes the response that indicates one or more of the 173 possible languages of the text with the respective probability of each language be the correct one.

Picture of Dave Smith
  Performance   Level  
Name: Dave Smith is available for providing paid consulting. Contact Dave Smith .
Classes: 51 packages by
Country: United States United States
Age: 58
All time rank: 618 in United States United States
Week rank: 21 Up4 in United States United States Up
Innovation award
Innovation award
Nominee: 32x

Winner: 7x

Example

<?php
/*
example usage
languageLayer ver 1.0

You must get an API key from https://languagelayer.com/product
and enter it in the langlayer.class.php file
*/

//turning off low level notices
error_reporting(E_ALL ^ E_NOTICE);

//text to test
$text = 'Ich bin mir sicher, dass dies die Sprache Deutsch';

//instantiate the class
include('langlayer.class.php');
$lang = new languageLayer();

//get the response from the api
$lang->getResponse($text);

//check for reported error
if( $lang->errorCode ){
   
    die(
'error ('.$lang->errorCode.'): '.$lang->errorText);
   
}

//show the response object
var_dump($lang->response);
?>


  Files folder image Files  
File Role Description
Accessible without login Plain text file example.php Example Example Usage
Plain text file langlayer.class.php Class Main Class
Accessible without login Plain text file license.txt Lic. License

 Version Control Unique User Downloads Download Rankings  
 0%
Total:137
This week:1
All time:9,240
This week:560Up