Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wimil/settings
This package allows you to save the configuration in a more persistent way. Use the database to save your settings, you can save values in json format. You can also override the Laravel configuration.
https://github.com/wimil/settings
Last synced: about 2 months ago
JSON representation
This package allows you to save the configuration in a more persistent way. Use the database to save your settings, you can save values in json format. You can also override the Laravel configuration.
- Host: GitHub
- URL: https://github.com/wimil/settings
- Owner: wimil
- Created: 2020-08-08T03:49:47.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-03-01T04:06:55.000Z (almost 4 years ago)
- Last Synced: 2024-09-21T13:50:11.361Z (4 months ago)
- Language: PHP
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Laravel Settings
This package allows you to save the configuration in a more persistent way. Use the database to save your settings, you can save values in json format. You can also override the Laravel configuration.
## Getting Started
### 1. Install
Run the following command:
```bash
composer require wimil/settings
```### 2. Register (for Laravel < 5.5)
Register the service provider in `config/app.php`
```php
Wimil\Settings\Provider::class,
```Add alias if you want to use the facade.
```php
'Settings' => Wimil\Settings\Facade::class,
```### 3. Publish
Publish config file.
```bash
php artisan vendor:publish --provider="Wimil\Settings\Provider"
```### 4. Configure
You can change the options of your app from `config/settings.php` file
## Usage
You can either use the helper method like `settings('foo')` or the facade `Settings::get('foo')`
### Facade
```php
Settings::get('foo');
Settings::set('foo', 'bar');
$settings = Settings::all();
```### Helper
```php
settings('foo');
settings('foo', 'bar');
$settings = settings();
```### Using your model
```php
use Wimil\Settings\Model\Setting as BaseSetting;
class Setting extends BaseSetting {}
```