Download the PHP package robtrehy/laravel-application-settings without Composer
On this page you can find all versions of the php package robtrehy/laravel-application-settings. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download robtrehy/laravel-application-settings
More information about robtrehy/laravel-application-settings
Files in robtrehy/laravel-application-settings
Package laravel-application-settings
Short Description A package for Laravel to store application settings for your project.
License MIT
Informations about the package laravel-application-settings
Laravel Application Settings
This is a package for Laravel that can be used to store and access settings for your application.
The settings are stored in a single database table. The default configuration stores this in a settings
table.
Installation
- Run
composer require robtrehy/laravel-application-settings
to include this in your project. -
Publish the config file with the following command
- Modify the published configuration file to your requirements. The file is located at
config/application-settings.php
. -
Add the
settings
table to the database. A migration file is included, just run the following commandThis will add the table defined in your configuration file to your database.
Configuration
Open config/application-settings.php
to adjust the packages configuration.
If this file doesn't exist, run
php artisan vendor:public --provider="RobTrehy\LaravelApplicationSettings\ApplicationSettingsServiceProvider" --tag="config"
to create the default configuration file.
Set table
, key
, and value
to match your requirements.
Laravel Application Settings uses the Laravel Cache driver to reduce the number of queries on your database. By default Laravel Caches using the file
driver. If you wish to disable this, you can use the null
driver.
The cache key supplied by Laravel Application Settings can be set by changing the cache.key
configuration value.
Example configuration
Usage
Set a Setting
Use this method to set a setting for the application
The setting will be immediately saved to the database
Get a Setting
Use this method to get the value of a setting for the application
Pass a second arguement to return a default value if the setting is not set, defaults to null
Get multiple Settings
Use this method to get the value of multiple settings for the application
Pass a second arguement to return a default value if the setting is not set, defaults to null
Get all Setting
Use this method to get all of the applications's settings as an array
Check if an Application Setting is set
To check if the application has a specific setting set, you can call
This will return true
if a value was found, false
if not.
Save a Setting
All settings are saved automatically when ApplicationSettings::set();
is called.
Delete a Setting
To delete a setting, you can call
There will be no return from this call.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
License
This Laravel package is free software distributed under the terms of the MIT license. See LICENSE
All versions of laravel-application-settings with dependencies
laravel/framework Version ^9.2|^10.0|^11.0
orchestra/testbench Version ^7.0|^8.0|^9.0