2017 © Pedro Peláez
 

composer-package laravel-variables

Management of variables/settings in Laravel projects

image

fomvasss/laravel-variables

Management of variables/settings in Laravel projects

  • Friday, May 18, 2018
  • by fomvasss
  • Repository
  • 1 Watchers
  • 0 Stars
  • 20 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 54 % Grown

The README.md

Laravel Variables

Latest Stable Version Total Downloads License Quality Score, (*1)

Dynamic management of variables/configs in Laravel app: creating and updating they in database, using cache and artisan commands, replace default Laravel configs, etc., (*2)

Installation

Run:, (*3)

composer require fomvasss/laravel-variables

Publish the config, migration:, (*4)

php artisan vendor:publish --provider="Fomvasss\Variable\VariableServiceProvider"

Run migrate:, (*5)

php artisan migrate

Usage

Facade Variable

<?php
Variable::all();
Variable::get('var_key');
Variable::save('app_name', 'My Var');

Use groupped (multilanguages) variables:, (*6)

<?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:, (*7)

Variable::saveArray('links', ['https::google.com', 'https://laravel.com']);   // save PHP array
Variable::getArray('links');    // return default PHP array!

Use cache variables:, (*8)

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, (*9)

Add keys in variable_config array: variable_key => config_key, (*10)

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., (*11)

Clear variable cache with console:, (*12)

php artisan variable:cache-clear

or, (*13)

php artisan cache:forget laravel.variables.cache

Clear variable cache in controller after update var:, (*14)

Variable::cacheClear();
//or
\Cache::forget('laravel.variables.cache');

The Versions

18/05 2018

dev-master

9999999-dev https://github.com/fomvasss/laravel-variables

Management of variables/settings in Laravel projects

  Sources   Download

MIT

The Requires

 

by Vasyl Fomin

laravel settings variable fomvasss

18/05 2018

1.2.1

1.2.1.0 https://github.com/fomvasss/laravel-variables

Management of variables/settings in Laravel projects

  Sources   Download

MIT

The Requires

 

by Vasyl Fomin

laravel settings variable fomvasss

18/05 2018

1.2.0

1.2.0.0 https://github.com/fomvasss/laravel-variables

Management of variables/settings in Laravel projects

  Sources   Download

MIT

The Requires

 

by Vasyl Fomin

laravel settings variable fomvasss

28/01 2018

1.1.0

1.1.0.0 https://github.com/fomvasss/laravel-variables

Management of variables/settings in Laravel projects

  Sources   Download

MIT

The Requires

 

by Vasyl Fomin

laravel settings variable fomvasss

21/12 2017

1.0.1

1.0.1.0 https://github.com/fomvasss/laravel-variables

Management of variables/settings in Laravel projects

  Sources   Download

MIT

The Requires

 

by Vasyl Fomin

laravel settings variable fomvasss

13/12 2017

1.0.0

1.0.0.0 https://github.com/fomvasss/laravel-variables

Management of variables/settings in Laravel projects

  Sources   Download

MIT

The Requires

 

by Vasyl Fomin

laravel settings variable fomvasss