Download the PHP package carry0987/i18n without Composer
On this page you can find all versions of the php package carry0987/i18n. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download carry0987/i18n
More information about carry0987/i18n
Files in carry0987/i18n
Package i18n
Short Description A modern internationalization system featuring JSON-format language files and efficient PHP-based caching. Supports dynamic language switching and real-time cache updates, ideal for rapid development and deployment of multilingual websites and applications.
License MIT
Informations about the package i18n
PHP-I18n
A modern internationalization system featuring JSON-format language files and efficient PHP-based caching. Supports dynamic language switching and real-time cache updates, ideal for rapid development and deployment of multilingual websites and applications.
Features
- Supports multiple language files
- Automatic caching of translation data for improved performance
- Supports organization of translation keys by namespaces
- Configurable translation file directory and cache directory
Requirements
- Composer
File Structure
Here's an example of the expected file structure:
Installation
Use Composer to install the I18n class library into your project:
Usage
After installation, you can include the I18n
class in your project with Composer's autoloading:
Fetch translations:
Fetch multiple translations:
Note
When accessing translations, the keys used must follow the format: filename.key
, which ensures that each translation value is extracted from the specified file.
Advanced Usage
If set useAutoDetect
to true
, the language will be automatically detected from the browser's Accept-Language
header. If the language is not supported, the default language will be used. Also, if you want to change cookie settings, you can set the cookie
option:
You can set the language code manually:
Load specific language files:
Set language aliases: