Downloads
Stars
Version
This package provides a service that enable to use any project config data as dictionary of codes with multilanguage support and cache using.
Run command in console
composer require laragrad/codifier
Add next lines into your config/app.php
$providers => [
...
\Laragrad\Codifier\CodifierServiceProvider::class,
],
$aliases => [
...
'Codifier' => \Laragrad\Codifier\CodifierServiceFacade::class,
],
Run command in console
php artisan vendor:publish
and type choise number to publish \Laragrad\Codifier\CodifierServiceProvider
Will be published next files:
/config/laragrad/codifier/config.php
- Package configuration/config/laragrad/codifier/example.php
- Example codifier data/resources/lang/vendor/laragrad/codifier/en/messages.php
- Package messages/resources/lang/vendor/laragrad/codifier/en/example.php
- Example codifier translationsSee package configuration example in file /config/laragrad/codifier/config.php
.
There are two root elements
Section configuration must have next options
Returns section element or full data.
get(string $section, string|null $path, string|null $locale) : array
Arguments:
Returns one section data.
getSection(string $section, string|null $locale) : array
Arguments:
Returns array of many of all sections.
getSections(array|null $sections, string|null $locale) : array
Arguments:
Warm cache keys if cache using enabled in configuration.
cache(array|string|null $sections, array|string|null $locales) : array
Arguments:
Returns list of messages.
Clear cache keys if cache using enabled in configuration.
clear(array|string|null $sections, array|string|null $locales) : array
Arguments:
Returns list of messages.