Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mschinis/laravel-settings

An easy to use, yet powerful way to store and retrieve application settings in your website.
https://github.com/mschinis/laravel-settings

Last synced: 5 days ago
JSON representation

An easy to use, yet powerful way to store and retrieve application settings in your website.

Awesome Lists containing this project

README

        

# Laravel Settings
Web-Application settings for Laravel. An easy way to use yet powerful way to store and retrieve settings in your database.
Use Settings for storing things like website title or general variables that are used throughout your development, and want to make the modification of these values easy.

Couple it together with a backend page to add/modify/delete settings on the fly, and you have yourself the perfect settings page.

### Installation

In your Laravel project's composer.json file, add `settings` as a dependency in the require object:

```js
"mschinis/settings": "dev-master"
```

Use `composer update` for composer to update the dependencies and download the package.

Once installed, add the ServiceProvider to your provider array and the Setting alias to your aliases array within `app/config/app.php`:

```php
'providers' => array(

'Mschinis\Settings\SettingsServiceProvider'

)

'aliases' => array(

'Setting' => 'Mschinis\Settings\Facades\Setting'

)
```

Setting up the database table is as easy as 1-2-3.

1. Publish the migration file to your migrations using `php artisan migrate:publish mschinis/settings`
2. Run the migration using `php artisan migrate`

Wait, no 3rd step? Yup. Tha-Tha-Tha-That's all folks! Enjoy using the settings package :)

### Usage
The package only stores the settings at the database, but more setting stores like redis/json file will be added soon.
The default table is `settings`. If you wish to modify the table name, you can do so by publishing the configuration file using `php artisan config:publish mschinis/settings` and changing the table in the published config file.

You can either access the setting store via its facade. A simple usage example is shown below.

```php

```

If the package fails to find a specific setting, and a default value is not provided, an exception will be thrown. To handle the exception you can use

```php

```

## Future work

1. Multilingual support for various extra fields, such as description.
2. Different storing mechanisms such as redis/json file.
3. Laravel 5 support.
4. Want anything else added? Please open up an issue on Github!

## Contact

Open an issue on GitHub if you have any problems or suggestions.

## License

The contents of this repository is released under the [MIT license](http://opensource.org/licenses/MIT).