Download the PHP package / without Composer

On this page you can find all versions of the php package /. 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?
/
Rate from 1 - 5
Rated 5.00 based on 2 reviews

Informations about the package

Charcoal Translator

License Latest Stable Version Code Quality Coverage Status SensioLabs Insight Build Status

A Charcoal service provider for the Symfony Translation component.

Provides internationalization (I18N) tools for translating messages and managing locales in multilingual applications.

Table of Contents

Installation

  1. The preferred (and only supported) method is with Composer:

  2. Add the service provider and configure the default translator / locale services via the application configset:

    or via the service container:

If you are using locomotivemtl/charcoal-app, the [TranslatorServiceProvider][translator-provider] is automatically registered by the AppServiceProvider.

Dependencies

Required

PSR

Dependents

Features

The Translation Object

Charcoal\Translator\Translation

The Translation Object holds the translation data for a given string in all available languages / locales.

The Translator Service

Charcoal\Translator\Translator

Charcoal's Translator extends Symfony's Translator to also provide two new translation methods (translation($val) and translator($val)) which can both accept mixed arguments to return either a Translation object, in the case of translation() or a string, in the case of translate($val).

The Locales Manager

Charcoal\Translator\LocalesManager

The Locales Manager is used to manage available locales / languages and keep track of current language.

The Parser Script

Charcoal\Translator\Script\TranslationParserScript

The Parser Script is used to scrape files that contain translatable content. Add the following route to your application configuration:

Service Provider

The TranslatorServiceProvider provides services and options for translating your application into different languages.

Parameters

Services

Configuration

Here is an example of configuration:

Middleware

The LanguageMiddleware is available for PSR-7 applications that support middleware. The middleware detects the preferred language using the Accept-Language HTTP header, the URI path, query string, or host.

If you are using locomotivemtl/charcoal-app, you can add the middleware via the application configset:

Otherwise, with Slim, for example:

The middleware comes with a set of default options which can be individually overridden.

Setting Type Default Description
active boolean FALSE Whether to enable or disable the middleware (locomotivemtl/charcoal-app only).
default_language string null The default language to use if no other languages is choosen.
browser_language string null The client's preferred language (Accept-Language).
use_browser boolean true Whether to use browser_language as the default language.
use_path boolean true Whether to lookup the HTTP request's URI path for a language code.
excluded_path string|array ^/admin\b One or more RegEx patterns to ignore from localization, when matching the URI path.
path_regexp string|array ^/([a-z]{2})\b One or more RegEx patterns to include from localization, when matching the URI path.
use_params boolean false Whether to lookup the HTTP request's URI query string for a language code.
param_key string|array current_language One or more RegEx patterns to include from localization, when matching the query string keys.
use_session boolean true Whether to lookup the client's PHP session for a preferred language.
session_key string|array current_language One or more RegEx patterns to include from localization, when matching the session keys.
use_host boolean false Whether to lookup the server host for a language code.
host_map string|array [] One or more RegEx patterns to include from localization, when matching the host.
set_locale boolean true Whether to set the environment's locale.

Helpers

TranslatorAwareTrait

Charcoal\Translator\TranslatorAwareTrait

The TranslatorAwareTrait is offered as convenience to avoid duplicate / boilerplate code. It simply sets and gets a Translator service property.

Set with setTranslator() and get with translator(). Both are protected method. (This trait has no public interface.)

Development

To install the development environment:

To run the scripts (phplint, phpcs and phpunit):

API Documentation

Development Dependencies

Coding Style

The charcoal-translator module follows the Charcoal coding-style:

Coding style validation / enforcement can be performed with composer phpcs. An auto-fixer is also available with composer phpcbf.

Credits

License

Charcoal is licensed under the MIT license. See LICENSE for details.


All versions of with dependencies

PHP Build Version
Package Version
No informations.
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 / contains the following files

Loading the files please wait ....