Download the PHP package rebelox/languages without Composer
On this page you can find all versions of the php package rebelox/languages. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rebelox/languages
More information about rebelox/languages
Files in rebelox/languages
Package languages
Short Description Languages allows you to easily make a multi-language website.
License MIT
Homepage https://github.com/RebeloX/language
Informations about the package languages
Languages 
Languages allows you to easily make a multi-language website.
How is it works
When a users opens the website, the API will gets the user's country using the geoip_country_code_by_name
function from the GeoIP API.
Then the API searches the configuration files and gets the right language and then by using the user's language the API gets the right message. If the user has a language cookie, the API will ignore the first step and will get the right message using the user's language saved on the cookie.
Installing
Install using composer
You can also visit the releases and download from there.
Configuration
First of all you need to configurate the api, the configuration is easy, you just need to create two files, one will be the languages file, and the other will be the messages file.
Languages File
The languages file should be like this
Where:
- default is the default language you want to your website use by default.
- lang1 and lang2 are the languages you want to define.
- countries is the the list of countries that use that language.
Here's an exemple:
You may want to check this list to see all ISO-3166 country codes.
======
Messages File
The messages' file structures:
Where
- message_name is the name you want to give to your message, it's also known has the identifier.
- lang1 and lang2 are the languages you defined on the languages file.
- Message (..) lang1 and lang2 are the messages in the respective languages.
Here's an exemple:
Basic Usage
Dependencies
To use this API you will need the GeoIP extension.
First you will need to install the .dll extension, follow this instructions guide. Then you will need the database, to get the database just click here and then install on your apache/bin folder.
Contributing
You're welcome to contribute to the better of this API, just file the issues under GitHub, or submit a pull request if you would like to contribute directly.
Examples
You can find some examples on the examples' folder, just try it yourself.
Build Tests
For now I don't have build tests available, I'm working on that...