dev-master
9999999-dev https://github.com/ExSituMarketing/EXS-silex-locale-detectorLocale detector bundle for Silex 2
MIT
The Requires
language silex locale provider detector
Wallogit.com
2017 © Pedro Peláez
Locale detector bundle for Silex 2
Locale detection with country and language breakdown, (*1)
It will get the accepted language and country from $_SERVER['HTTP_ACCEPT_LANGUAGE'] and will check it against Db., (*2)
If it's not found in Db, it will insert it and return the new entry., (*3)
Results are cached with memcache., (*4)
Create a composer.json in your projects root-directory :, (*5)
{
"require": {
"EXS/silex-locale-detector": "~1.0@dev"
}
}
and run :, (*6)
$ curl -sS http://getcomposer.org/installer | php $ php composer.phar install
or run this command: ``` shell composer require exs/silex-locale-detector ~1.0@dev, (*7)
Composer will now update all dependencies and you should see our bundle in the list: ``` shell - Installing exs/silex-locale-detector (dev-master 463eb20) Cloning 463eb2081e7205e7556f6f65224c6ba9631e070a
CREATE TABLE `locales` ( `id` smallint(6) NOT NULL AUTO_INCREMENT, `tag` varchar(10) COLLATE utf8_unicode_ci NOT NULL, `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, `created` datetime NOT NULL, `modified` datetime NOT NULL, PRIMARY KEY (`id`), KEY `tag` (`tag`) ) ENGINE=InnoDB AUTO_INCREMENT=134 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; CREATE TABLE `languages` ( `id` smallint(6) NOT NULL AUTO_INCREMENT, `tag` varchar(10) COLLATE utf8_unicode_ci NOT NULL, `language` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `created` datetime NOT NULL, `modified` datetime NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `unique_language` (`tag`) ) ENGINE=InnoDB AUTO_INCREMENT=142 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; CREATE TABLE `countries` ( `id` smallint(6) NOT NULL AUTO_INCREMENT, `iso3166alpha2` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL, `iso3166alpha3` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, `iso3166numeric` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, `fips` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL, `country` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `continent` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL, `created` datetime NOT NULL, `modified` datetime NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `unique_country` (`iso3166alpha2`) ) ENGINE=InnoDB AUTO_INCREMENT=259 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
$app->register(new \EXS\LocaleProvider\Providers\ServiceProvider());
$app->register(new \EXS\LocaleProvider\Providers\ServiceProvider());
// Simple use
$language = $app['exs.serv.locale.detector']->getLanguage();
$local = $app['exs.serv.locale.detector']->getLocale();
$country = $app['exs.serv.locale.detector']->getCountry();
Silex 2.0, (*8)
Doctrine\Dbal 2.2, (*9)
kuikui/memcache-service-provider ~2.0, (*10)
You need a memcache server up and running., (*11)
The LocaleDetectorPovider for Silex is licensed under the MIT license., (*12)
Anyone and everyone is welcome to contribute., (*13)
If you have any questions or suggestions please [let us know][1]., (*14)
Locale detector bundle for Silex 2
MIT
language silex locale provider detector