PHPackages                             themahabbat/lang - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. themahabbat/lang

ActiveLibrary

themahabbat/lang
================

Language changer

1.0.0.x-dev(8y ago)216MITPHPPHP &gt;=5.3.0

Since Apr 22Pushed 8y agoCompare

[ Source](https://github.com/themahabbat/Lang-PHP)[ Packagist](https://packagist.org/packages/themahabbat/lang)[ Docs](https://github.com/themahabbat/Lang-PHP)[ RSS](/packages/themahabbat-lang/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Lang-PHP
========

[](#lang-php)

Language changer for PHP

Initialization
--------------

[](#initialization)

Add `"minimum-stability": "dev"` to `composer.json`

Run `composer require themahabbat/lang`

### Parameters

[](#parameters)

`current`: Current language

`available`: Array of available languages

`dir` (optional): Directory of language files exists (default: lang)

`default`: Default language if current language doesn't match available languages

`cookie` (optional): Cookie name (default: LANG)

`cookieExpire` (optional): Expire time for cookies in Unix timestamp (default: 168 days)

### How it works

[](#how-it-works)

Script finds `.json` files in given language directory then initializes it

### Code

[](#code)

```
