icanboogie/bind-cldr

Binds CLDR to ICanBoogie

v3.0.0 2018-12-01 13:17 UTC

README

Release Build Status Code Quality Code Coverage Packagist

Binds icanboogie/cldr to ICanBoogie, using its Autoconfig feature.

<?php

$app = ICanBoogie\boot();

# Getting the CLDR
echo get_class($app->cldr);                        // ICanBoogie\CLDR\Repository
echo $app->cldr->locales['fr']['languages']['fr']; // français

# Getting the current locale, defaulting to 'en' locale
echo get_class($app->locale);                      // ICanBoogie\CLDR\Locale
echo $app->locale;                                 // en

# Setting the current locale to French
$app->locale = 'fr-FR';
echo get_class($app->locale);                      // ICanBoogie\CLDR\Locale
echo $app->locale;                                 // fr-FR
echo $app->language;                               // fr

Prototype methods

The following prototype methods are provided:

  • ICanBoogie\Application::lazy_get_cldr_provider: A lazy getter that returns a ProviderCollection instance. A FileProvider instance is used in the collection and is configured to use <ICanBoogie\REPOSITORY>cache/cldr as cache directory. A APCStorage instance is also part of the collection if APC is available.

  • ICanBoogie\Application::lazy_get_cldr: A lazy getter that returns a Repository instance created with the CLDR provider.

  • ICanBoogie\Application::set_locale: Sets the locale used by the application.

  • ICanBoogie\Application::get_locale: Returns the locale used by the application.

Requirements

The package requires PHP 5.6 or later.

Installation

The recommended way to install this package is through Composer:

$ composer require icanboogie/bind-cldr

Cloning the repository

The package is available on GitHub, its repository can be cloned with the following command line:

$ git clone https://github.com/ICanBoogie/bind-cldr.git

Documentation

The package is documented as part of the ICanBoogie framework documentation. You can generate the documentation for the package and its dependencies with the make doc command. The documentation is generated in the docs directory. ApiGen is required. You can later clean the directory with the make clean command.

Testing

The test suite is ran with the make test command. Composer is automatically installed as well as all dependencies required to run the suite. You can later clean the directory with the make clean command.

The package is continuously tested by Travis CI.

Build Status Code Coverage

License

icanboogie/bind-cldr is licensed under the New BSD License - See the LICENSE file for details.