tsekka/data-loader

For Laravel framework. Adds helper function to access static data kept in data directory.

0.1.3 2022-02-14 08:15 UTC

This package is auto-updated.

Last update: 2024-09-14 14:24:34 UTC


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
  1. Create file in root/data directory:
// your-app-root-directory/data/packages.php
return [
   'base' => [
      'title' => __('Base Package'),
      'price' => 25
   ], // ...
];
  1. 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.