Download the PHP package benmorel/languagelayer without Composer

On this page you can find all versions of the php package benmorel/languagelayer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package languagelayer

LanguageLayer API client for PHP

Perform language detection in PHP using the LanguageLayer API.

Latest Stable Version License

Note: LanguageLayer is not being maintained anymore, and API calls started failing as of November 2020. This library is therefore archived.

Installation

This library is installable via Composer:

Requirements

This library requires PHP 7.1 or later.

Quickstart

You need a free API key from LanguageLayer to get started.

Just instantiate the LanguageLayer client, and start detecting:

The detectLanguages() method returns an array of LanguageDetectionResult objects, that you can inspect to decide what to do with each detected language.

Using https

You can use the API over a secure connection, if you have a paid plan that supports it:

Detecting a single language

As a convenience, the detectLanguage() method helps you detect a single language from a text:

This method loops through the results to find a single reliable result. If it there is no reliable result, but the API returned a single result, it will also accept it, unless the second parameter, $forceReliable, is set to true:

If no single, acceptable result is found, a LanguageDetectionException is thrown.

Error handling

Any kind of error—an HTTP error, an error returned by the API, or any other kind of error related to this library—throws a LanguageDetectionException.

Therefore you should wrap all your detectLanguage() and detectLanguages() calls in a try/catch block:

If the exception was caused by an HTTP error, you can inspect the underlying Guzzle exception by calling $exception->getPrevious() if needed.

If the exception was caused by an error returned by the LanguageLayer API itself, you can inspect it, in addition to the exception message, with $exception->getCode() and $exception->getType().

You can, for example, act upon specific API errors:

Note: if the exception was not caused by an error returned by the API itself, getType() will return null.

See the LanguageLayer documentation for a list of error codes and types.


All versions of languagelayer with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
guzzlehttp/guzzle Version ^6.0 || ^7.0
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package benmorel/languagelayer contains the following files

Loading the files please wait ....