Hoa central

Hoa is a modular, extensible and structured set of PHP libraries. Moreover, Hoa aims at being a bridge between industrial and research worlds.


This library allows to get the informations of the locale from the system, the HTTP client or something else.


With Composer, to include this library into your dependencies, you need to require `hoa/locale`:

```json { "require": { "hoa/locale": "~1.0" } } ```

Please, read the website to get more informations about how to install.

Quick usage

We propose a quick overview to get the locale and related informations about an HTTP client. Next, we will see the other localizers.

Locale from an HTTP client

To get the locale from an HTTP client, we will use the Hoa\Locale\Localizer\Http localizer. Then, we will print the result of the following interesting methods:


```php $locale = new Hoa(new Hoa());

echo 'language : ', $locale->getLanguage(), "\n", 'script : ', $locale->getScript(), "\n", 'region : ', $locale->getRegion(), "\n", 'variant : ', implode(', ', $locale->getVariants()), "\n"; ```

For example, with the Accept-Language HTTP header set to zh-Hant-TW-xy-ab-123, we will have:

``` language : zh script : Hant region : TW variant : xy, ab, 123 ```

Other localizers

So far, we also have the Hoa\Locale\Localizer\System to get the locale informations from the system and Hoa\Locale\Localizer\Coerce to get them from an arbitrary locale representation.


Different documentations can be found on the website: http://hoa-project.net/.


Hoa is under the New BSD License (BSD-3-Clause). Please, see `LICENSE`.