Download the PHP package inclus16/laravel-dictionary without Composer
On this page you can find all versions of the php package inclus16/laravel-dictionary. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download inclus16/laravel-dictionary
More information about inclus16/laravel-dictionary
Files in inclus16/laravel-dictionary
Package laravel-dictionary
Short Description Provide cached collection-based data in laravel
License MIT
Informations about the package laravel-dictionary
Laravel dictionary
Laravel dictionary is a package, that manages access, validation and cache for your collection-based data.
A dictionary is a static (or nearly static) set of data that needs to be reread very often.
Prerequirements
PHP >= 8.5
Laravel >=13
Install
The package will automatically register a service provider Publish the package's configuration and translations by running:
Configuration
In .env file there constants that can be added:
DICTIONARY_DEFAULT_CACHE_STORE - see Laravel cache (default: array)
DICTIONARY_DEFAULT_CACHE_TTL - see Laravel cache (default: 3600)
Usage
The main class that you may work with is some classes that may be called DictionaryHandler.
This class must be registered in config dictionary.php:
Full methods of AbstractDictionaryHandler that can be extended:
Validation
For validation, you may use one of two rules:
This rule will search in dictionary {slug}, iterates over cached entities and compare value from request with {field} value from entity. If entity with equality will found - validation will be passed
This rule will search in dictionary {slug}, iterates over cached entities and compare value from request with {field} value from entity. If entity with equality does NOT found - validation will be passed
Access in code
Facade
Just one method. This will return a dictionary handler with this {slug}, or throw OutOfRangeException
DI
Inject \Inclus16\LaravelDictionary\Handler\HandlerFactory class
Static files
For optimization purposes you may call
this command with create json files that contains data of dictionary. for each dictionary there will be created a file, named {dictionarySlug}.json in disk from config: dictionary.publishDisk. Then you can handle this files directly via nginx as static files
Http access
All versions of laravel-dictionary with dependencies
illuminate/console Version ^13.0
illuminate/support Version ^13.0
illuminate/http Version ^13.0
illuminate/validation Version ^13.0
illuminate/testing Version ^13.0