Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kolirt/laravel-settings
⚙️ Package for managing settings in a Laravel projects
https://github.com/kolirt/laravel-settings
laravel settings settings-management settings-storage
Last synced: about 1 month ago
JSON representation
⚙️ Package for managing settings in a Laravel projects
- Host: GitHub
- URL: https://github.com/kolirt/laravel-settings
- Owner: kolirt
- License: mit
- Created: 2019-05-22T04:39:16.000Z (over 5 years ago)
- Default Branch: v2
- Last Pushed: 2024-09-08T08:57:44.000Z (4 months ago)
- Last Synced: 2024-11-18T09:46:42.691Z (about 2 months ago)
- Topics: laravel, settings, settings-management, settings-storage
- Language: PHP
- Homepage:
- Size: 25.4 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.txt
Awesome Lists containing this project
README
# Laravel Settings
Package for managing settings in a Laravel projects## Structure
- [Getting started](#getting-started)
- [Requirements](#requirements)
- [Installation](#installation)
- [Setup](#setup)
- [Methods](#methods)
- [Set value](#set-value)
- [Get all values](#get-all-values)
- [Get value](#get-value)
- [Delete value](#delete-value)
- [Flush cache](#flush-cache)
- [Console commands](#console-commands)
- [FAQ](#faq)
- [License](#license)
- [Other packages](#other-packages)## Getting started
### Requirements
- PHP >= 8.1
- Laravel >= 10For lesser versions of Laravel or PHP, use the [v1](https://github.com/kolirt/laravel-settings/tree/v1)
### Installation
```bash
composer require kolirt/laravel-settings
```### Setup
```bash
php artisan settings:installphp artisan migrate
```## Console commands
- `settings:install` - Install settings package
- `settings:publish-config` - Publish the config file
- `settings:publish-migrations` - Publish migration files
- `settings:flush-cache` - Flush cache## Methods
#### `set`
The `set` method is used to set a value in the settings```php
use Kolirt\Settings\Facades\Setting;Setting::set('string', 'value');
Setting::set('array', [0, 1, 2]);
Setting::set('array.0', 'new value with index 0');
```#### `all`
The `all` method is used to get all settings```php
use Kolirt\Settings\Facades\Setting;Setting::all();
/**
* Returns
*
* [
* 'string' => 'value',
* 'array' => ['new value with index 0', 1, 2]
* ]
*/
```#### `get`
The `get` method is used to get a value from the settings```php
use Kolirt\Settings\Facades\Setting;Setting::get('string'); // 'value'
Setting::get('array'); // ['new value with index 0', 1, 2]
Setting::get('array.0'); // 'new value with index 0'// or via helper
setting('string'); // 'value'
setting('array'); // ['new value with index 0', 1, 2]
setting('array.0'); // 'new value with index 0'
```#### `delete`
The `delete` method is used to delete a value from the settings```php
use Kolirt\Settings\Facades\Setting;Setting::delete('string');
Setting::delete('array'); // delete all array values
Setting::delete('array.0'); // delete array value with index 0
```#### `flushCache`
The `flushCache` method is used to flush the cache```php
use Kolirt\Settings\Facades\Setting;Setting::flushCache();
```## FAQ
Check closed [issues](https://github.com/kolirt/laravel-settings/issues) to get answers for most asked questions## License
[MIT](LICENSE.txt)## Other packages
Check out my other packages on my [GitHub profile](https://github.com/kolirt)