gigabait93/laravel-settings

Settings for Laravel.

v1.0.0 2025-08-15 18:50 UTC

This package is not auto-updated.

Last update: 2025-09-19 14:05:35 UTC


README

A small package for saving and cache settings in Laravel.

Installation

  1. Set the package:

    composer require gigabait93/laravel-settings
  2. Publish Config and Migration (optional):

    php artisan vendor:publish --provider="Gigabait93\LaravelSettings\Providers\LaravelSettingsServiceProvider" --tag=config
    php artisan vendor:publish --provider="Gigabait93\LaravelSettings\Providers\LaravelSettingsServiceProvider" --tag=migrations
  3. Complete the migration:

    php artisan migrate

Використання

Obtaining and setting values:

use Gigabait93\LaravelSettings\Facades\Settings;

Settings::set('site.name', 'My Site');
$name = Settings::get('site.name');

// or helper
sset('items_per_page', 20);
$value = sget('items_per_page');

Managing a group of values:

settings()->setMany([
    'a' => 1,
    'b' => true,
]);

$values = settings()->many(['a', 'b']); // ['a' => 1, 'b' => true]

Cache

The package uses cache to reduce the number of references to the database. Cash setup can be changed in the file config/settings.php:

  • ttl — Storage time in seconds (0 turns off cache).
  • prefix — Key prefix.
  • other parameters describe keys and tags.

License

MIT