PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Dave Smith   PHP Language Detection Library   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example Usage
Class: PHP Language Detection Library
Detect the language of a text using APILayer
Author: By
Last change:
Date: 7 years ago
Size: 662 bytes


Class file image Download
example usage
languageLayer ver 1.0

You must get an API key from
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
$lang = new languageLayer();

//get the response from the api

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

//show the response object