Download the PHP package darrynten/google-cloud-translate-php without Composer

On this page you can find all versions of the php package darrynten/google-cloud-translate-php. 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 google-cloud-translate-php

google-cloud-translate-php

Travis Build Status StyleCI Status codecov Packagist Version MIT License

An unofficial, fully unit tested Google Cloud Translate PHP client with extra sugar.

This is pretty much based on our Google Natural Language library and is quite similar.

PHP 7.0+

Why not just use the official one?

The official one is great, and we actually use it in this package, it just doesn't quite have the sort of features we needed, so we wrapped it up with some extra bits.

What extra features?

Cost Cutters

The Google Cloud Translate API costs money. If you're doing anything with it at scale, you're going to have to keep an eye on your calls to make sure things aren't running away with you. It's not cheap.

That's why we introduced some cost cutting features.

Caching Requests

By default this package caches your requests, something you would have to usually do yourself.

It caches using a framework-agnostic approach, whereby it leverages any host frameworks caching mechanism, and falls back to a temporary cache if there is no cache available.

The supported frameworks are detailed in the AnyCache project.

Examples include Laravel, Symfony, Doctrine, Psr6 and more.

This feature is on by default and can easily be disabled.

Cheapskate Mode

While not immediately clear, the Google Cloud Translate API charges per character. At the time of writing around $20 for 1m characters. (you pay for detection and translation at the same rates).

If you wish to first detect the language and then translate, you will pay twice for each character.

We're added cheapskate mode, and what this setting allows is for you to limit the amount of text used in language detection.

This feature is on by default and can easily be disabled. By default it limits language detection to a tweet worth of characters, and you can adjust the value too through the cheapskateCount property.

Additional Cost Saving Checks

If you submit a language that is not supported then you still get charged per character, so we ensure that we grab a copy of all supported languages and translation targets to make sure that you don't attempt to translate across unsupported languages, saving you money.

We also check to ensure you are not trying to translate the same target and source, which would also be expensive.

Conveniences

There are a few other conveniences like being able to set the target and source language, type, etc.

One use case would be running a single instance of text through multiple language attempts.

Usage

See The Google Cloud Docs for more on these options and their usage.

Please note that while the Google Cloud Translation API supports authentication via service account and application default credentials like other Cloud Platform APIs, it also supports authentication via a public API access key.

If you wish to authenticate using an API key, follow the before you begin instructions to learn how to generate a key.

Options

If no language is provided then it is autodetected from the text and is returned with the response.

Missing Features

Feel free to open a PR!

Usage of Google\Cloud\Storage\StorageObject is presently not possible.

Roadmap

Acknowledgements


All versions of google-cloud-translate-php with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0
google/cloud Version ^0.20.2
darrynten/any-cache Version ^1.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 darrynten/google-cloud-translate-php contains the following files

Loading the files please wait ....