zonuexe/http-accept-language

0.4.1 2014-10-19 09:22 UTC

README

Package version Build Status Downloads this Month Scrutinizer Code Quality

Description

Teto\HTTP\AcceptLanguage is HTTP Accept-Language header parser based on PHP Locale module.

Requirements

  • PHP (5.4+)
    • ext/intl

Installation

Composer

Get Composer. (use composer or composer.phar command)

cd /path/to/your-project
composer require 'zonuexe/http-accept-language:~0.4.1'

Usage

see tests/public/greeting.php.

API

  • Teto\HTTP\AcceptLanguage::detect()
  • Teto\HTTP\AcceptLanguage::get()
  • Teto\HTTP\AcceptLanguage::getLanguages()
  • Teto\HTTP\AcceptLanguage::parse()

Features

  • Accepts *(wildcard) tag
    • *-Hant-*{language: '*', script: 'Hant'}
    • zh-*-TW{language: 'zh', region: 'TW'}

Reference

Copyright

HTTP Accept-Language header parser for PHP

Copyright (c) 2016 USAMI Kenta / Baguette HQ