PHPackages                             devfactory/variables - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. devfactory/variables

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

devfactory/variables
====================

Laravel package to allow site owners to override a specific config files' variables

2.0.6(10y ago)23.9kMITPHPPHP &gt;=5.4.0

Since Nov 24Pushed 10y ago4 watchersCompare

[ Source](https://github.com/DevFactoryCH/variables)[ Packagist](https://packagist.org/packages/devfactory/variables)[ RSS](/packages/devfactory-variables/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (3)Versions (14)Used By (0)

[![Laravel](https://camo.githubusercontent.com/e90e164c5687bb6ebfc16f3a5d856441e96acf66f502df3895ef47aa852c0c72/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d342e302d6f72616e67652e7376673f7374796c653d666c61742d737175617265)](http://laravel.com)[![Laravel](https://camo.githubusercontent.com/fefa73cbcb138f313755edeb816d67030c8ca82a24371d2c30c4605f1a1d6b86/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d352e302d6f72616e67652e7376673f7374796c653d666c61742d737175617265)](http://laravel.com)[![License](https://camo.githubusercontent.com/30597ff9a350144f03bffdd9183e16468e0b3ca1193e1d08591d992622738d55/687474703a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://tldrlegal.com/license/mit-license)

\#Variables

This is a package for the Laravel framework, it allows for a specified set of variables to be overridden in the database by the user of the site

Installation
------------

[](#installation)

### Laravel 5

[](#laravel-5)

Using Composer, edit your `composer.json` file to require `devfactory/media`.

```
"require": {
  "devfactory/variables": "2.0.*"
}

```

Then from the terminal run

```
composer update

```

Then in your `app/config/app.php` file register the service provider:

```
'Devfactory\Variables\VariablesServiceProvider',
```

and the Facade:

```
'Variables' => 'Devfactory\Variables\Facades\VariablesFacade',
```

From within the the laravel folder of your project, run:

```
php artisan vendor:publish

```

Run the migration to create the DB table:

```
php artisan migrate

```

You have to add the Controller to your routes.php, so that you can set your own url/filters.

```
Route::group(array('before' => 'admin-auth'), function() {
  Route::controller('variables', '\Devfactory\Variables\Controllers\VariablesController');
});
```

### Laravel 4

[](#laravel-4)

Using Composer, edit your `composer.json` file to require `devfactory/media`.

```
"require": {
  "devfactory/variables": "1.0.*"
}

```

Then from the terminal run

```
composer update

```

Then in your `app/config/app.php` file register the service provider:

```
    'Devfactory\Variables\VariablesServiceProvider',
```

and the Facade:

```
    'Variables' => 'Devfactory\Variables\Facades\VariablesFacade',
```

Run the migration to create the DB table:

```
php artisan migrate --package=devfactory/variables

```

Finally, publish the config to make changes to where and how the files are stored:

```
php artisan config:publish devfactory/variables

```

You have to add the Controller to your routes.php, so that you can set your own url/filters.

```
    Route::group(array('before' => 'admin-auth'), function() {
        Route::controller('variables', 'Devfactory\Variables\Controllers\VariablesController');
    });
```

Usage
-----

[](#usage)

Visiting the url you set in your routes file as shown above, allows you to see all the current variables, as well as override them by entering a new value and saving.

You can then use the variables through calls to the `Variables` facade:

```
