tsekka / data-loader
For Laravel framework. Adds helper function to access static data kept in data directory.
Requires
- php: ^7.1|^8.0
- illuminate/support: ^6.0|^7.0|^8.0|^9.0
README
Keep static data in specified folder. Access with global helper function.
Installation
You can install the package via composer:
composer require tsekka/data-loader
Usage
Store & access the static data the same way as you store & access laravel config's.
However, the configurations are loaded very early in Laravel application's lifecycle so there is no access to many features(most importantly localization) in config files.
Basic example
- Create file in root/data directory:
// your-app-root-directory/data/packages.php return [ 'base' => [ 'title' => __('Base Package'), 'price' => 25 ], // ... ];
- Use data() helper to access:
// DemoController.php App::setLocale('es'); return data('packages.base.title'); // returns 'Paquete base' (if there is a translation for Base Package)
Changelog
Please see CHANGELOG for more information what has changed recently.
Security
If you discover any security related issues, please email pintek@pintek.ee instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.