laravel-variables maintained by fomvasss
Last update
2025/06/24 12:37
License
Require
- php ^7.4|^8.0
- illuminate/support ^8.0|^9.0|^10.0|^11.0|^12.0
- illuminate/database ^8.0|^9.0|^10.0|^11.0|^12.0
- illuminate/cache ^8.0|^9.0|^10.0|^11.0|^12.0
Last update
2025/06/24 12:37
License
Require
- php ^7.4|^8.0
- illuminate/support ^8.0|^9.0|^10.0|^11.0|^12.0
- illuminate/database ^8.0|^9.0|^10.0|^11.0|^12.0
- illuminate/cache ^8.0|^9.0|^10.0|^11.0|^12.0
Last update
2024/09/26 21:32
License
Require
- php ^7.4|^8.0
- illuminate/support ^8.0|^9.0|^10.0|^11.0
- illuminate/database ^8.0|^9.0|^10.0|^11.0
- illuminate/cache ^8.0|^9.0|^10.0|^11.0
Last update
2024/09/26 21:30
License
Require
- php ^7.4|^8.0
- illuminate/support ^8.0|^9.0|^10.0|^11.0
- illuminate/database ^8.0|^9.0|^10.0|^11.0
- illuminate/cache ^8.0|^9.0|^10.0|^11.0
Last update
2024/09/26 21:30
License
Require
- php ^7.4|^8.0
- illuminate/support ^8.0|^9.0|^10.0|^11.0
- illuminate/database ^8.0|^9.0|^10.0|^11.0
- illuminate/cache ^8.0|^9.0|^10.0|^11.0
Last update
2024/05/26 16:33
License
Require
- php ^7.4|^8.0
- illuminate/support ^8.0|^9.0|^10.0|^11.0
- illuminate/database ^8.0|^9.0|^10.0|^11.0
- illuminate/cache ^8.0|^9.0|^10.0|^11.0
Last update
2024/05/26 16:33
License
Require
- php ^7.4|^8.0
- illuminate/support ^8.0|^9.0|^10.0|^11.0
- illuminate/database ^8.0|^9.0|^10.0|^11.0
- illuminate/cache ^8.0|^9.0|^10.0|^11.0
Last update
2024/03/20 18:13
License
Require
- php ^7.4|^8.0
- illuminate/support ^8.0|^9.0|^10.0|^11.0
- illuminate/database ^8.0|^9.0|^10.0|^11.0
- illuminate/cache ^8.0|^9.0|^10.0|^11.0
Last update
2023/03/02 12:10
License
Require
- php ^7.4|^8.0
- illuminate/support ^8.0|^9.0|^10.0
- illuminate/database ^8.0|^9.0|^10.0
- illuminate/cache ^8.0|^9.0|^10.0
Last update
2023/02/14 09:54
License
Require
- php ^7.4|^8.0
- illuminate/support ^8.0|^9.0|^10.0
- illuminate/database ^8.0|^9.0|^10.0
- illuminate/cache ^8.0|^9.0|^10.0
Last update
2022/10/05 23:21
License
Require
- php ^7.4|^8.0
- illuminate/support ^8.0|^9.0
- illuminate/database ^8.0|^9.0
- illuminate/cache ^8.0|^9.0
Last update
2022/10/05 23:21
License
Require
- php ^7.4|^8.0
- illuminate/support ^8.0|^9.0
- illuminate/database ^8.0|^9.0
- illuminate/cache ^8.0|^9.0
Last update
2022/10/05 22:43
License
Require
- php ^7.4|^8.0
- illuminate/support ^8.0|^9.0
- illuminate/database ^8.0|^9.0
- illuminate/cache ^8.0|^9.0
Last update
2022/10/05 22:29
License
Require
- php ^7.4|^8.0
- illuminate/support ^8.0|^9.0
- illuminate/database ^8.0|^9.0
- illuminate/cache ^8.0|^9.0
Last update
2022/05/23 22:19
License
Require
- php ^7.1.3|^8.0
- illuminate/support ^5.7|^5.8|^6.0|^7.0|^8.0|^9.0
- illuminate/database ^5.7|^5.8|^6.0|^7.0|^8.0|^9.0
- illuminate/cache ^5.7|^5.8|^6.0|^7.0|^8.0|^9.0
Last update
2022/05/23 22:19
License
Require
- illuminate/support ^5.7|^5.8|^6.0|^7.0|^8.0|^9.0
- illuminate/database ^5.7|^5.8|^6.0|^7.0|^8.0|^9.0
- php ^7.1.3|^8.0
- illuminate/cache ^5.7|^5.8|^6.0|^7.0|^8.0|^9.0
Last update
2022/03/25 15:49
License
Require
- php ^7.4|^8.0
- illuminate/support ^8.0|^9.0
- illuminate/database ^8.0|^9.0
- illuminate/cache ^8.0|^9.0
Last update
2022/03/11 13:06
License
Require
- php ^7.4|^8.0
- illuminate/support ^8.0|^9.0
- illuminate/database ^8.0|^9.0
- illuminate/cache ^8.0|^9.0
Last update
2022/03/07 19:38
License
Require
- php ^7.4|^8.0
- illuminate/support ^8.0|^9.0
- illuminate/database ^8.0|^9.0
- illuminate/cache ^8.0|^9.0
Last update
2022/03/07 09:42
License
Require
- php ^7.4|^8.0
- illuminate/support ^8.0|^9.0
- illuminate/database ^8.0|^9.0
- illuminate/cache ^8.0|^9.0
Last update
2020/11/30 20:11
License
Require
- php ^7.1.3
- illuminate/support ^5.7|^5.8|^6.0|^7.0|^8.0
- illuminate/database ^5.7|^5.8|^6.0|^7.0|^8.0
- illuminate/cache ^5.7|^5.8|^6.0|^7.0|^8.0
Last update
2020/11/30 00:21
License
Require
- php ^7.1.3
- illuminate/support ^5.7|^5.8|^6.0|^7.0|^8.0
- illuminate/database ^5.7|^5.8|^6.0|^7.0|^8.0
- illuminate/cache ^5.7|^5.8|^6.0|^7.0|^8.0
Last update
2020/08/03 19:38
License
Require
- php ^7.1.3
- illuminate/support ^5.7|^5.8|^6.0|^7.0
- illuminate/database ^5.7|^5.8|^6.0|^7.0
- illuminate/cache ^5.7|^5.8|^6.0|^7.0
Last update
2020/08/03 17:10
License
Require
- php ^7.1.3
- illuminate/support ^5.7|^5.8|^6.0|^7.0
- illuminate/database ^5.7|^5.8|^6.0|^7.0
- illuminate/cache ^5.7|^5.8|^6.0|^7.0
Last update
2020/07/30 22:06
License
Require
- php ^7.1.3
- illuminate/support ^5.7|^5.8|^6.0|^7.0
- illuminate/database ^5.7|^5.8|^6.0|^7.0
- illuminate/cache ^5.7|^5.8|^6.0|^7.0
Last update
2020/07/30 21:54
License
Require
- php >=7.2.0
- illuminate/support ^5.8|^6.0|^7.0
- illuminate/database ^5.8|^6.0|^7.0
- illuminate/cache ^5.8|^6.0|^7.0
Last update
2020/05/12 11:55
License
Require
- php >=7.2.0
- illuminate/support ^5.8|^6.0|^7.0
- illuminate/database ^5.8|^6.0|^7.0
- illuminate/cache ^5.8|^6.0|^7.0
Last update
2020/03/03 21:44
License
Require
- php >=7.2.0
- illuminate/support ^5.8|^6.0|^7.0
- illuminate/database ^5.8|^6.0|^7.0
- illuminate/cache ^5.8|^6.0|^7.0
Last update
2019/09/24 21:14
License
Require
- php >=7.2.0
- illuminate/support ^5.8|^6.0
- illuminate/database ^5.8|^6.0
- illuminate/cache ^5.8|^6.0
Last update
2019/05/09 18:17
License
Require
- php >=7.2.0
- illuminate/support 5.8.*
- illuminate/database 5.8.*
- illuminate/cache 5.8.*
Last update
2019/02/18 17:03
License
Require
- php >=7.0.0
- illuminate/support 5.5.*|5.6.*|5.7.*
- illuminate/database 5.5.*|5.6.*|5.7.*
- illuminate/cache 5.5.*|5.6.*|5.7.*
Last update
2018/12/26 20:40
License
Require
- php >=7.0.0
- illuminate/support 5.5.*|5.6.*|5.7.*
- illuminate/database 5.5.*|5.6.*|5.7.*
- illuminate/cache 5.5.*|5.6.*|5.7.*
Last update
2018/12/20 23:05
License
Require
- php >=7.0.0
- illuminate/support 5.5.*|5.6.*|5.7.*
- illuminate/database 5.5.*|5.6.*|5.7.*
- illuminate/cache 5.5.*|5.6.*|5.7.*
Last update
2018/12/20 23:01
License
Require
- php >=7.0.0
- illuminate/support 5.5.*|5.6.*|5.7.*
- illuminate/database 5.5.*|5.6.*|5.7.*
- illuminate/cache 5.5.*|5.6.*|5.7.*
Last update
2018/05/18 10:52
License
Require
- php >=7.0.0
- illuminate/support 5.4.*|5.5.*|5.6.*
- illuminate/database 5.4.*|5.5.*|5.6.*
- illuminate/cache 5.4.*|5.5.*|5.6.*
Last update
2018/05/18 10:49
License
Require
- php >=7.0.0
- illuminate/support 5.4.*|5.5.*|5.6.*
- illuminate/database 5.4.*|5.5.*|5.5.*
- illuminate/cache 5.4.*|5.5.*|5.5.*
Last update
2018/01/28 14:41
License
Require
- php >=7.0.0
- illuminate/support 5.3.*|5.4.*|5.5.*
- illuminate/database 5.3.*|5.4.*|5.5.*
- illuminate/cache 5.3.*|5.4.*|5.5.*
Last update
2017/12/21 18:06
License
Require
- php >=7.0.0
- illuminate/support 5.3.*|5.4.*|5.5.*
- illuminate/database 5.3.*|5.4.*|5.5.*
- illuminate/cache 5.3.*|5.4.*|5.5.*
Last update
2017/12/13 18:06
License
Require
- php >=7.0.0
- illuminate/support 5.3.*|5.4.*|5.5.*
- illuminate/database 5.3.*|5.4.*|5.5.*
Laravel Variables
Dynamic management of variables/configs in Laravel app: creating and updating they in database, using cache and artisan commands, replace default Laravel configs, etc.
Installation
Run:
composer require fomvasss/laravel-variables
Publish the config, migration:
php artisan vendor:publish --provider="Fomvasss\Variable\VariableServiceProvider"
Run migrate:
php artisan migrate
Usage
Facade Variable
<?php
Variable::all();
Variable::get('var_key');
Variable::save('app_name', 'My Var');
Use groupped (multilanguages) variables:
<?php
Variable::setGroup('en')->all(); // return Collection!
Variable::setGroup('uk')->get('var_key');
Variable::get('var_key', null, 'en');
Variable::get('en|var_key');
Variable::save('uk|var_key', 'UK var');
Use array (json) variables:
Variable::saveArray('links', ['https::google.com', 'https://laravel.com']); // save PHP array
Variable::getArray('links'); // return default PHP array!
Use cache variables:
Variable::setGroup('uk')->save('app_name', 'Blog');
Variable::setGroup('uk')->useCache(false)->get('app_name');
//or
Variable::get('var_key', null, 'uk', false);
Helpers
variable($name, $default = null, $group = null);
Replace Laravel configs with variables
Set in config/variables.php option config_key_for_vars=vars
Add keys in variable_config array: variable_key => config_key
Console command
variable:all # Show all variables
variable:get # Get single variable
variable:save # Save single variable
variable:cache-clear # Cache clear all variables
Use cache
Set in config/variables.php option cache.time seconds for cache.
Clear variable cache with console:
php artisan variable:cache-clear
or
php artisan cache:forget laravel.variables.cache
Clear variable cache in controller after update var:
Variable::cacheClear();
//or
\Cache::forget('laravel.variables.cache');