PHPackages                             postare/db-config - 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. postare/db-config

Abandoned → [inerba/filament-db-config](/?search=inerba%2Ffilament-db-config)Library[Utility &amp; Helpers](/categories/utility)

postare/db-config
=================

This plugin simplifies configuration management in Filament projects, enabling the easy creation and management of dynamic configuration pages.

4.0.2(10mo ago)31592MITPHPPHP ^8.2CI failing

Since Jan 24Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/postare/db-config)[ Packagist](https://packagist.org/packages/postare/db-config)[ Docs](https://github.com/postare/db-config)[ GitHub Sponsors](https://github.com/postare)[ RSS](/packages/postare-db-config/feed)WikiDiscussions main Synced yesterday

READMEChangelog (2)Dependencies (10)Versions (17)Used By (2)

DB Config
=========

[](#db-config)

[![Latest Version on Packagist](https://camo.githubusercontent.com/3f10307d918130a1d1c7a6f8cb98c3a30488b981479d0eaca90c000e3f72b81d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706f73746172652f64622d636f6e6669672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/postare/db-config)[![Total Downloads](https://camo.githubusercontent.com/39b853addbe7bae1e229fb652482398072deb2ee49fdc2a6ca82b96cb0c54fb1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f706f73746172652f64622d636f6e6669672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/postare/db-config)

DB Config is a Filament plugin that provides a simple, database-backed key/value store for application settings, along with a streamlined way to build settings pages using Filament. It exposes a clean API for reading and writing values and uses transparent caching under the hood.

It is framework-friendly, requires no custom Eloquent models in your app, and persists values as JSON in a dedicated table.

Requirements
------------

[](#requirements)

- PHP version supported by your Laravel installation
- Laravel 10, 11 or 12
- A database engine with JSON support (MySQL 5.7+, MariaDB 10.2.7+, PostgreSQL, SQLite recent versions)
- Filament 3.x or 4.x (see Compatibility)

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

[](#installation)

Install the package via Composer (choose the version matching your Laravel version):

```
composer require postare/db-config:^2.0 # Laravel 10
composer require postare/db-config:^3.0 # Laravel 11
composer require postare/db-config:^4.0 # Laravel 12
```

Publish and run the migration:

```
php artisan vendor:publish --tag="db-config-migrations"
php artisan migrate
```

This creates a `db_config` table used to store your settings.

Compatibility
-------------

[](#compatibility)

- Laravel 10 + Filament 3 → `postare/db-config:^2.0`
- Laravel 11 + Filament 3 → `postare/db-config:^3.0`
- Laravel 12 + Filament 4 → `postare/db-config:^4.0`

Usage of the `make:db_config` command
-------------------------------------

[](#usage-of-the-makedb_config-command)

The package provides an Artisan generator that quickly creates a Filament settings page (Page class + Blade view).

Command:

```
php artisan make:db_config {name} {panel?}
```

Parameters:

- `name`: the settings group name (e.g. `website`). It is used to generate the view name and the class name (singular, capitalized).
- `panel` (optional): the Filament panel to create the page in (e.g. `Admin`). If omitted the default panel is used.

Examples:

```
php artisan make:db_config website
php artisan make:db_config website admin
```

What is generated:

- A Page class at `app/Filament/{Panel}/Pages/{Name}Settings.php` (the class name is the singular form of `{name}` + `Settings`, e.g. `WebsiteSettings.php`).
- A Blade view at `resources/views/filament/config-pages/{slug-name}-settings.blade.php` (the view name is a slugified version of the `name` with a `-settings` suffix).

Behavior:

- The command does not overwrite existing files: if the class or the view already exist it will warn and leave the files intact.
- Names are normalized: the class uses the singular form of the provided name, the view is slugified (spaces and special characters are converted).

Note: the generated class extends `Postare\DbConfig\AbstractPageSettings` and the view is placed under `resources/views/filament/config-pages/`.

How it works
------------

[](#how-it-works)

Settings are organized by a two-part key: `group.setting`, with optional nested sub-keys (e.g. `group.setting.nested.key`).

Under the hood:

- Settings are stored in a single row per `(group, key)` with the JSON payload in the `settings` column.
- Reads are cached forever under the cache key `db-config.{group}.{setting}`.
- Writes clear the corresponding cache entry to keep reads fresh.

Filament integration
--------------------

[](#filament-integration)

This package ships with an Artisan generator and an abstract Page class to quickly scaffold Filament settings pages.

Generate a settings page (and its Blade view):

```
php artisan make:db_config website            # default panel
php artisan make:db_config website admin      # specific panel (e.g. Admin)
```

What gets generated:

- A Page class in `app/Filament/{Panel}/Pages/*SettingsPage.php` that extends `Postare\DbConfig\AbstractPageSettings`.
- A Blade view at `resources/views/filament/config-pages/{name}.blade.php` which renders the page content.

Page lifecycle and saving:

- On `mount()`, the page loads all settings for the given group (defined by `settingName()`) via `DbConfig::getGroup()` and fills the page content state.
- A built-in header action “Save” persists the current state by calling `DbConfig::set("{group}.{key}", $value)` for each top-level key present in the page content.

Defining the page content:

- Implement `protected function settingName(): string` to define the group name (e.g. `website`).
- Implement `public function content(Schema $schema): Schema` and return your content schema.
- Set `->statePath('data')` so the page state is bound to the `$data` property and saved correctly.

Example page content (Filament schema):

```
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Schema; // or import the correct Schema depending on your setup

public function content(Schema $schema): Schema
{
    return $schema
        ->components([
            TextInput::make('site_name')->required(),
            // ... other inputs
        ])
        ->statePath('data');
}
```

Database schema
---------------

[](#database-schema)

The `db_config` table contains:

- `id` (bigint, primary key)
- `group` (string)
- `key` (string)
- `settings` (json, nullable)
- `created_at`, `updated_at` (timestamps)

There is a unique index on (`group`, `key`). Timestamps are present but not used by the package logic and may remain null depending on your database defaults.

API
---

[](#api)

The package exposes a minimal API for interacting with settings.

Read a value (helper):

```
db_config('website.site_name', 'Default Name');
```

Read a value (class):

```
\Postare\DbConfig\DbConfig::get('website.site_name', 'Default Name');
```

Write a value:

```
\Postare\DbConfig\DbConfig::set('website.site_name', 'Acme Inc.');
```

Read an entire group as associative array:

```
\Postare\DbConfig\DbConfig::getGroup('website');
// => [ 'site_name' => 'Acme Inc.', 'contact' => ['email' => 'info@acme.test'] ]
```

Facade (optional):

```
\Postare\DbConfig\Facades\DbConfig::get('website.site_name');
```

> The `db_config()` helper is auto-registered by the package and is the recommended way to read values in application code.

Keys and nested data
--------------------

[](#keys-and-nested-data)

- Keys are split by dots. The first segment is the `group`, the second is the top-level `setting`, and any remaining segments are treated as nested keys inside the stored JSON.
- Example: `profile.preferences.theme` stores/reads from row `(group=profile, key=preferences)` and resolves the nested path `theme` inside the JSON payload.
- Avoid using group-only keys (e.g. `profile`) — always specify at least `group.setting`.

Examples:

```
// Store a nested structure
\Postare\DbConfig\DbConfig::set('profile.preferences', [
    'theme' => 'dark',
    'notifications' => ['email' => true, 'sms' => false],
]);

// Read a nested value with default
db_config('profile.preferences.theme', 'light'); // 'dark'

// Read a missing nested value
db_config('profile.preferences.timezone', 'UTC'); // 'UTC'
```

Caching behavior
----------------

[](#caching-behavior)

- Reads are cached forever per `(group, setting)` to minimize database traffic.
- `DbConfig::set()` automatically clears the cache for the affected `(group, setting)` pair.
- When debugging, you can clear the framework cache (`php artisan cache:clear`) to reset all cached values.

Return values and defaults
--------------------------

[](#return-values-and-defaults)

- If a value or nested path does not exist, the provided default is returned.
- If the stored JSON value is `null`, the default is returned.
- `getGroup()` returns an associative array of all settings for the group, or an empty array if none exist.

Database engines
----------------

[](#database-engines)

This package stores settings as JSON. Ensure your chosen database supports JSON columns. For SQLite (common in tests), JSON is stored as text and works transparently for typical use cases.

Security considerations
-----------------------

[](#security-considerations)

- Do not store secrets that belong in environment variables or the configuration cache (API keys, DB credentials). Use this package for runtime-editable application settings (e.g. labels, feature flags, contact info).
- Values are not encrypted by default. If you need encryption, wrap reads/writes with your own encryption layer before passing to the API.

Versioning
----------

[](#versioning)

This package follows semantic versioning. Use a version constraint compatible with your Laravel version as shown in the installation section.

License
-------

[](#license)

The MIT License (MIT). See the LICENSE file for more details.

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance54

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~41 days

Recently: every ~131 days

Total

15

Last Release

318d ago

Major Versions

1.11 → 2.02024-02-28

2.03 → 3.02024-03-12

2.04 → 4.0.02025-08-18

PHP version history (2 changes)1.0PHP ^8.1

3.01PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/c9951f7bf6251c81aceb7df0a295359cd0d2356543350c6a1a988d4b60f3f981?d=identicon)[inerba](/maintainers/inerba)

---

Top Contributors

[![inerba](https://avatars.githubusercontent.com/u/5882517?v=4)](https://github.com/inerba "inerba (52 commits)")

---

Tags

configurationfilament-pluginfilamentadminfilamentphplaravellaraveldb-configpostare

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/postare-db-config/health.svg)

```
[![Health](https://phpackages.com/badges/postare-db-config/health.svg)](https://phpackages.com/packages/postare-db-config)
```

###  Alternatives

[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[stephenjude/filament-jetstream

A Laravel starter kit built with Filament inspired by Jetstream.

17760.2k3](/packages/stephenjude-filament-jetstream)[stephenjude/filament-debugger

About

104162.2k2](/packages/stephenjude-filament-debugger)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329530.5k29](/packages/codewithdennis-filament-select-tree)[stephenjude/filament-feature-flags

Filament implementation of feature flags and segmentation with Laravel Pennant.

122177.8k1](/packages/stephenjude-filament-feature-flags)[finity-labs/fin-mail

A powerful email template manager and composer for Filament with dynamic token replacement, template versioning, and inline email sending.

284.5k1](/packages/finity-labs-fin-mail)

PHPackages © 2026

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