PHPackages                             toneflix-code/laravel-dbconfig - 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. toneflix-code/laravel-dbconfig

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

toneflix-code/laravel-dbconfig
==============================

A Laravel package that allows you to configure your app using database entries with support for Arrays and files.

1.1.4(3mo ago)2524↓100%1[2 PRs](https://github.com/toneflix/laravel-dbconfig/pulls)1MITPHPPHP ^8.1|^8.2|^8.3CI passing

Since Jan 20Pushed 1mo agoCompare

[ Source](https://github.com/toneflix/laravel-dbconfig)[ Packagist](https://packagist.org/packages/toneflix-code/laravel-dbconfig)[ Docs](https://github.com/toneflix/laravel-dbconfig)[ RSS](/packages/toneflix-code-laravel-dbconfig/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (21)Used By (1)

Laravel DbConfig (Database Configuration)
=========================================

[](#laravel-dbconfig-database-configuration)

[![Test & Lint](https://github.com/toneflix/laravel-dbconfig/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/toneflix/laravel-dbconfig/actions/workflows/run-tests.yml)[![Latest Stable Version](https://camo.githubusercontent.com/ddb6fbb612b996cee9249939b0eef777c6d348eacb5f1103cf46d1bf517e95d0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f6e65666c69782d636f64652f6c61726176656c2d6462636f6e6669672e737667)](https://packagist.org/packages/toneflix-code/laravel-dbconfig)[![Total Downloads](https://camo.githubusercontent.com/832f6ca24c98fe82d80625ffbaf4d4f8006cf19fc601967ee281b6c29f4f5ffe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f6e65666c69782d636f64652f6c61726176656c2d6462636f6e6669672e737667)](https://packagist.org/packages/toneflix-code/laravel-dbconfig)[![License](https://camo.githubusercontent.com/ece2444ef50f579b4794b8c4a006dbb16db278207656cb6bfcf4817c9925009c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f6e65666c69782d636f64652f6c61726176656c2d6462636f6e6669672e737667)](https://packagist.org/packages/toneflix-code/laravel-dbconfig)[![PHP Version Require](https://camo.githubusercontent.com/ed9430d9fbb2220288fbd91a0954ccc8134ed82451b6e6b87df5e0c2b1ce414f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f746f6e65666c69782d636f64652f6c61726176656c2d6462636f6e6669672f706870)](https://packagist.org/packages/toneflix-code/laravel-dbconfig)[![codecov](https://camo.githubusercontent.com/b9368909596d7b246b5f589c74ee5896b9262772367cc5542e71464496002717/68747470733a2f2f636f6465636f762e696f2f67682f746f6e65666c69782f6c61726176656c2d6462636f6e6669672f67726170682f62616467652e7376673f746f6b656e3d324f376146756c513950)](https://codecov.io/gh/toneflix/laravel-dbconfig)

A Laravel package that enables app configuration using database entries with support for arrays and files. Includes support for single and multiple file uploads, custom tables, and a `dbconfig` helper function.

Features
--------

[](#features)

- Support for single and multiple file uploads.
- Has `dbconfig()` helper function.
- Support for custom tables.
- Create configurations with `php artisan dbconfig:create` command.
- Support for Arrays.
- Configurations can be dbconfig:d.
- Update config with `php artisan dbconfig:set` command.

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

[](#installation)

You can install the package via composer:

```
composer require toneflix-code/laravel-dbconfig
```

### Package Discovery

[](#package-discovery)

Laravel automatically discovers and publishes service providers but optionally after you have installed Laravel Fileable, open your Laravel config file if you use Laravel below 11, `config/app.php` and add the following lines.

In the $providers array add the service providers for this package.

```
ToneflixCode\DbConfig\DbConfigServiceProvider::class
```

If you use Laravel &gt;= 11, open your `bootstrap/providers.php` and the above line to the array.

```
return [
    ToneflixCode\DbConfig\DbConfigServiceProvider::class,
];
```

### Asset Publishing

[](#asset-publishing)

To customize migrations, publish the migration files with:

```
php artisan vendor:publish --tag="dbconfig-migrations"
```

To customize configuration options, publish the config file with:

```
php artisan vendor:publish --tag="dbconfig"
```

### Custom Tables

[](#custom-tables)

If you need to customize the names of the tables used, edit the `table` property of the `laravel-dbconfig` configuration file, setting the table names according to your requirement.

### Migration

[](#migration)

Once you're doing with initial setup, run `php artisan migrate` to migrate your database, when you have done this, then the library is ready for use.

Usage
-----

[](#usage)

### Creating Configuration Options

[](#creating-configuration-options)

#### Artisan Command

[](#artisan-command)

To create configuration options from the CLI you can use the [dbconfig:create](#dbconfigcreate) Artisan command

#### Database seeding

[](#database-seeding)

If you have multple options and do not want to add them one after the other, you can publish the `factory` and `seeder` then modify the seeder, adding in all the option you require in the array and seeding your database as usual.

1. Publish `factory` and `seeder` by running `php artisan vendor:publish --tag dbconfig-data`.
2. Modify seeder.
3. Seed your database by running `php artisan db:seed ConfigurationSeeder`.

### Accessing configuration

[](#accessing-configuration)

To access your saved configuration, you can call the `config` helper method on the `Configure` class.

```
use ToneflixCode\DbConfig\Helpers\Configure;

dd(Configure::config(key: 'app_name'));
```

Or use the flat helper function.

```
dd(dbconfig(key: 'app_name'));
```

### Accessing all configuration option

[](#accessing-all-configuration-option)

If you do not provide a key when calling `Configure::config()` or `dbconfig()` an instance of `Illuminate\Support\Collection` will be returned with all available configuration options as \[key =&gt; value\] pair collection.

```
use ToneflixCode\DbConfig\Helpers\Configure;

dd(Configure::config());
```

Or

```
dd(dbconfig());
```

### Updating Configurations

[](#updating-configurations)

Passing an array to the `dbconfig` function or the `config` method will imply that you want to update the configuration option.

```
use ToneflixCode\DbConfig\Helpers\Configure;

Configure::config(key: ['app_name' => 'Toneflix']);
```

Or

```
dbconfig(key: ['app_name' => 'Toneflix']);
```

In either case, the calls will return an instance of `\Illuminate\Support\Collection` with the current state of the config.

Supported Data types
--------------------

[](#supported-data-types)

When creating configuration options, you will be required to provide a value for the `type` attribute, which is used to determine what kind of data to expect from the config `value`.

This library supports the following data types as values:

1. `string`
2. `bool`
3. `int`
4. `float`
5. `json`
6. `file`

For convinience and in order to provide flexibility, we will also map the following `type` config values to their applicable data types:

1. \[`textarea`, `text`\]: `string`
2. \[`number`, `integer`\]: `int`
3. \[`boolean`\]: `bool`
4. \[`file`\]: array of `file`
5. The `json` data type will automatically be wrapped with an `\Illuminate\Support\Collection` instance.

Secret Data
-----------

[](#secret-data)

When creating your options, if you set the `secret` attribute to `true`, the value will automatically be masked whenever it is accessed.

To allow secret values to be visible, when you call the `Configure::config()` or `dbconfig()` methods, set the `loadSecret` argument to true, this will ensure that, even secret values are visible.

```
use ToneflixCode\DbConfig\Helpers\Configure;

Configure::config(key: ['app_name' => 'Toneflix'], loadSecret: true);
```

Or

```
dbconfig(key: ['app_name' => 'Toneflix'], loadSecret: true);
```

Files
-----

[](#files)

Configuration options of `type` `file` will be uploaded to your configured storage driver and a direct link to the file will be generated and passed as the configuration `value`.

Whe the configuration type is `files`, the files will be uploaded and you will get an `\Illuminate\Support\Collection` of direct link urls to all the uploaded files.

### Storage path

[](#storage-path)

The library uses `toneflix-code/laravel-fileable` for storing files, you can configure the upload path and othe options by modifying the `upload_collection` property of the `laravel-dbconfig` configuration file or add a `dbconfig` collection to the `toneflix-fileable` configuration.

### Saving configuration with file values

[](#saving-configuration-with-file-values)

To save a configuration with a file value, simply pass an instance of `Illuminate\Http\UploadedFile` as a value when setting the configuration, the lirary takes care of the rest.

```
use ToneflixCode\DbConfig\Helpers\Configure;

Configure::config(key: ['logo' => request()->file('logo')]);
```

Or

```
dbconfig(key: ['logo' => request()->file('logo')]);
```

Artisan Commands
----------------

[](#artisan-commands)

The library ships with 4 artisan commands provided to to make working with the library a little bit less straining, maybe, but let's get to it.

### `dbconfig:create`

[](#dbconfigcreate)

The `dbconfig:create` command allows you to create new configuration options, to use, run it like in the examples below.

```
php artisan dbconfig:create
```

You will be presented with interactive questions to help you create your config option, alternatively, you can also pass the option definition directly to the command to create without prompts:

```
php artisan dbconfig:create [options] [--] [ [ [ [ [ [...]]]]]] [--group [--secret [--cols [--max [--force]]]]]
```

When you run the `dbconfig:create` passing all options directly, you will still be required to confirm, where you do not want to to be required to confirm, you can pass the `--force` option, which will run the command without prompts.

### `dbconfig:purge`

[](#dbconfigpurge)

The `dbconfig:purge` command allows you to purge or remove configuration options from the database.

```
php artisan dbconfig:create []
```

Running the command without arguments will cause the entire configuration table to be truncated but if you wish to only remove a particular key from the table, simply pass the key argument.

### `dbconfig:set`

[](#dbconfigset)

The `dbconfig:set` command allows you to set or update the value of a configuration option.

```
php artisan dbconfig:set
```

You will be presented with interactive questions to help you update the value of your config option, alternatively, you can also pass the key and value arguments directly to the command to update without the prompts:

```
php artisan dbconfig:set [ []]
```

### `dbconfig:show`

[](#dbconfigshow)

The `dbconfig:show` command will display all of the values for the database configurations.

```
php artisan dbconfig:show
```

### `dbconfig:sync`

[](#dbconfigsync)

The `dbconfig:sync` command is an alias for `artisan db:seed --class=ConfigurationSeeder`, it will run your configuration seeder if it exists, optionally you can pass the required seeder class an argument.

```
php artisan dbconfig:sync
```

OR

```
php artisan dbconfig:sync ConfigSeeder
```

### Additional

[](#additional)

You may also run the `php artisan about` command to see usefull information about your confiuration state.

And that's it folks, happy coding...

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

TODO
----

[](#todo)

- Add dbconfig: status to about command.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Toneflix Code](https://github.com/toneflix)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance92

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 83.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~22 days

Recently: every ~79 days

Total

18

Last Release

97d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4638f9de973d94753ebff641af3009e1049064f9a6bd76fe87e58d0d8ddd7ca7?d=identicon)[3m1n3nc3](/maintainers/3m1n3nc3)

---

Top Contributors

[![3m1n3nc3](https://avatars.githubusercontent.com/u/52163001?v=4)](https://github.com/3m1n3nc3 "3m1n3nc3 (135 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (15 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (12 commits)")

---

Tags

apiconfigurationSettingsconfigdatabaseupdatessavefix

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/toneflix-code-laravel-dbconfig/health.svg)

```
[![Health](https://phpackages.com/badges/toneflix-code-laravel-dbconfig/health.svg)](https://phpackages.com/packages/toneflix-code-laravel-dbconfig)
```

###  Alternatives

[kreait/laravel-firebase

A Laravel package for the Firebase PHP Admin SDK

1.3k16.5M42](/packages/kreait-laravel-firebase)[illuminatech/config

Provides support for Laravel application runtime configuration managed in persistent storage

14921.0k1](/packages/illuminatech-config)[arcanedev/laravel-settings

This package allows you to persists configs/settings for Laravel projects.

74131.4k6](/packages/arcanedev-laravel-settings)[cornford/setter

An easy way to integrate Database Settings with Laravel.

151.0k](/packages/cornford-setter)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
