Download the PHP package gino-pane/phpolyglot without Composer

On this page you can find all versions of the php package gino-pane/phpolyglot. 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 phpolyglot

PHPolyglot

Latest Stable Version Build Status Maintainability Test Coverage Scrutinizer Code Quality License Total Downloads

Combining and featuring different APIs for language translation, dictionary lookup, spelling correction and speech synthesis (TTS) in an easy to use and extend way.

Table of Contents

Features

Requirements

Installation

Create a copy of .env.example file, name it .env and put your own API credentials in it. File contains links to pages which may be related to required credentials.

In order to run examples from examples directory you have to specify your own valid API credentials.

Basic Usage

The package contains a plenty of ready-to-use examples in examples directory. All endpoints either return a valid response or throws a relevant exception. All APIs are configured through config.php file which contains the default API classes mapping. Support of dynamic configs was added in 1.1.0 update:

This allows you to pass your own configuration values if you don't want to rely on those that are stored in configuration files.

Translation

There are two endpoints. For a single string:

and for multiple strings:

As a minimum example you can pass text and language to translate into (source language will be detected by API):

TranslateResponse has getTranslations method which returns an array of translations.

Supported languages may vary depending on third-party API.

Yandex Translate API

Please check the list of supported languages. Yandex Translate API is free to use with limitations (1000 000 characters per day, up to 10 000 000 per month). If you want you can get a paid plan of course. The API won't let you to get into paid plan automatically, it will simply return an error when the limit is reached. In order to use the API you need to get the valid API key.

Dictionary Lookup

There is a single endpoint, which can be used in two different forms.

For a lookup within the same language (get word forms):

and for translation-with-lookup (get multiple translations and additional information including word forms, examples, meanings, synonyms, transcription, etc.):

As a minimum example you can pass text and its source language:

Supported languages may vary depending on third-party API.

Yandex Dictionary API

Please check the list of supported languages. Yandex Dictionary API is free to use with limitations (up to 10 000 references per day). In order to use the API you need to get the valid API key.

Spelling Check

There are two endpoints. For a single string:

and for multiple strings:

As a minimum example you can pass only a text to check:

Supported languages may vary depending on third-party API.

Yandex Speller API

Please check the list of supported languages (basically, only English, Russian and Ukrainian are supported at the moment). Yandex Speller API is free to use with limitations (up to 10 000 calls/10 000 000 characters per day). No keys are required.

Speech Synthesis

The main endpoint is PHPolyglot's speak method:

Only two parameters are required - text for synthesis $text and its source language $languageFrom.

Optional parameters $audioFormat and $additionalData may be omitted. Audio format allows to explicitly specify the required audio format of returned audio. Additional data allows to set API specific parameters for more precise results (voice, pitch, speed, etc.).

The list of audio formats which are currently recognized:

Please note that not all of them may be supported by your API of choice.

The TTS method returns TtsResponse which has storeFile method to store generated file with required name and extension into the specified directory (or by using default values):

By default the file name is a simple md5 hash of $text that was used for TTS, $extension is being populated based on content-type header (at least, for IBM Watson API), $directory is based on config setting.

IBM Watson Text-to-Speech

Please check the list of supported languages and voices. IBM Watson TTS requires API credentials for authorization. Create your TTS project there and get your API-specific credentials. API is free to use with limitations (up to 10 000 characters per month).

Possible ToDos

Useful Tools

Running Tests:

php vendor/bin/phpunit

or

composer test

Code Sniffer Tool:

php vendor/bin/phpcs --standard=PSR2 src/

or

composer psr2check

Code Auto-fixer:

php vendor/bin/phpcbf --standard=PSR2 src/ 

or

composer psr2autofix

Building Docs:

php vendor/bin/phpdoc -d "src" -t "docs"

or

composer docs

Changelog

To keep track, please refer to CHANGELOG.md.

Contributing

  1. Fork it;
  2. Create your feature branch (git checkout -b my-new-feature);
  3. Make your changes;
  4. Run the tests, adding new ones for your own code if necessary (phpunit);
  5. Commit your changes (git commit -am 'Added some feature');
  6. Push to the branch (git push origin my-new-feature);
  7. Create new pull request.

Also please refer to CONTRIBUTING.md.

License

Please refer to LICENSE.

The PHPolyglot does not own any of results that APIs may return. Also, APIs may have their own rules about data usage, so beware of them when you use them.

Notes

Powered by composer-package-template and PHP Nano Rest.


All versions of phpolyglot with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1
vlucas/phpdotenv Version ^2.4
gino-pane/nano-rest Version ~1.2.0
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 gino-pane/phpolyglot contains the following files

Loading the files please wait ....