Download the PHP package guizoxxv/laravel-json-lang without Composer
On this page you can find all versions of the php package guizoxxv/laravel-json-lang. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download guizoxxv/laravel-json-lang
More information about guizoxxv/laravel-json-lang
Files in guizoxxv/laravel-json-lang
Package laravel-json-lang
Short Description A package to export Laravel language files as JSON.
License MIT
Informations about the package laravel-json-lang
Laravel JSON Lang
A package to export Laravel PHP translation files as JSON.
How it works
This package adds a command that processes input files by grouping them according to their respective languages. For each language, a job is dispatched to enable parallel processing. This job handles the files by reading each translation key and updating it or not, in a JSON translation file. The JSON translation keys are structured to ensure that the translation helper function works the same way as it would if the translations were coming from PHP files.
Installation
-
Require the package via Composer:
-
Publish the package's configuration file:
- Run the command to export files:
Configuration
The following configuration parameters are available:
1. input_paths
An array of target file system paths to be processed. Each element in the array should be a string representing either a file path or a directory path. The path should be absolute, starting from the root of the application.
Example:
In this example, /path/to/specific/file.php
is a single file that will be processed, while all .php
files within /path/to/directory/
and its subdirectories will also be processed.
Vendor prefix
When using package translations, a key/value pair with the path as key and package namespace as value to indicate the correct translation prefix.
Example:
2. output_path
Specifies the directory where the JSON translation files should be saved.
3. override_existing_keys
If a key already exists in the JSON translation files, specifies whether to keep the ones in the JSON file (false
) or override with the value from the PHP file being processed (true
).
4. languages
An array (allowlist) of languages to be processed. When not provided, all available languages will be processed.
Observations
- This package reads the full content of translation files into memory. Should you encounter memory issues, try reducing the number of languages being processed at once.