PHPackages                             poisa/settings - 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. [Database &amp; ORM](/categories/database)
4. /
5. poisa/settings

ActiveLibrary[Database &amp; ORM](/categories/database)

poisa/settings
==============

A Laravel multi-tenant database configuration/settings manager

0.1.13(7y ago)406.1k↑59.5%3MITPHPPHP &gt;=7.0.0

Since Dec 14Pushed 7y ago1 watchersCompare

[ Source](https://github.com/poisa/Settings)[ Packagist](https://packagist.org/packages/poisa/settings)[ RSS](/packages/poisa-settings/feed)WikiDiscussions master Synced yesterday

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

[![Build Status](https://camo.githubusercontent.com/82b6756661b20a3c30bfaa7752df5560403d616daac3814dcdbab84d42224b54/68747470733a2f2f7472617669732d63692e6f72672f706f6973612f53657474696e67732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/poisa/Settings)[![codecov](https://camo.githubusercontent.com/f1e8e7bf899fba0009d3673f0aed56426b3a5405a95847054fda6642e47efedb/68747470733a2f2f636f6465636f762e696f2f67682f706f6973612f53657474696e67732f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/poisa/Settings)[![Maintainability](https://camo.githubusercontent.com/3286e2cfd87189e4252dd85fedfc0ae5cf1bdf7ab9b39ae42f081144d8ba7a1f/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f32666163666338616165613866616562356534352f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/poisa/Settings/maintainability)[![SensioLabsInsight](https://camo.githubusercontent.com/7a690ad40d6b147a9b2af71757c8c2001366c8dca8e0d296588d437b87fab427/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f61666233633333322d366663392d343332392d613933332d3262376332343466343637642f736d616c6c2e706e67)](https://insight.sensiolabs.com/projects/afb3c332-6fc9-4329-a933-2b7c244f467d)

Settings: A Laravel 5 multi-tenant settings manager
===================================================

[](#settings-a-laravel-5-multi-tenant-settings-manager)

### Package objective

[](#package-objective)

To be able to store custom configuration items in a database in a single or multi-tenant environment either in plain text, encrypted form, or any other customizable format. By configuration I am not referring to Laravel's configuration but rather to your domain-specific configuration.

There are 3 specific scenarios where this package might come in handy:

1. Multi-tenant systems where you deploy the code to one server and it connects to a different tenant database depending on domain rules (eg. different users connect to different databases).
2. Same as #1 except you add a main database that you always connect to. Take a CMS for example, where you have the CMS's own database (a.k.a. the `system` database) and then you also connect to each of your client's databases (a.k.a the `tenant` database). In this scenario you work simultaneously with both databases.
3. A single-tenant website with just one database.

This package really shines when you need to store odd-ball data for which you would not necessarily want to create a separate table.

**Think of this package as a key-value store that knows about data types -even custom ones- that can encrypt data at rest and can also fire events.**

Index
=====

[](#index)

- [Release notes](#release-notes)
- [Installation](#installation)
- [Use](#use)
- [Known data types](#known-data-types)
- [Custom data types](#custom-data-types) &lt;-- the meat 🍖 and potatoes 🍟 (and reason for creating this package)
- [Events](#events)
- [CLI Commands](#cli-commands)

Release notes
=============

[](#release-notes)

- 0.1.13 - Added config option to ignore migrations. Useful for people who want to manage the migrations themselves.
- 0.1.12 - Initial release.

Installation
============

[](#installation)

Installation can be done automatically using [Composer](https://getcomposer.org).

```
composer require poisa/settings

```

Next you will need to publish the package configuration.

```
php artisan vendor:publish

```

You will be asked to chose a package. Find `Poisa\Settings\SettingsServiceProvider` and select it. This will create a new configuration file in your project: `config/settings.php`. You will need to edit it and choose the config options that suit your project before continuing.

Now you will need to execute the migrations found in the package. These will create the database tables that the package will use to store your settings.

```
php artisan migrate

```

> Important: The migrations will run in your default database connection. This is fine if you are only using one database but if you will be using the package in many databases then you will need to run the migrations in all your databases:

```
php artisan migrate --database=

```

Alternatively you can use your own SQL manager software to copy the table over to the databases and servers that you need.

Use
===

[](#use)

The simplest use case assumes that you only have one database and no custom data types.

```
