# inerba/filament-db-config architecture

> Architecture diagram of the GitHub repository inerba/filament-db-config, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/inerba/filament-db-config
- Repository: https://github.com/inerba/filament-db-config

## Overview

DB Config is a Laravel/Filament plugin for editing grouped settings and content, persisting values as JSON, and retrieving them through helpers or Blade. The main workflow is an administrator editing and saving a generated Filament settings page, followed by application code reading the values. The README also documents widgets, flexible Filament form components, and caching. Some internals are represented from documentation and the file tree because their source was not sampled.

Main entry points: [`src/DbConfig.php`](https://github.com/inerba/filament-db-config/blob/main/src/DbConfig.php) (DB Config API), [`src/Commands/DbConfigCommand.php`](https://github.com/inerba/filament-db-config/blob/main/src/Commands/DbConfigCommand.php) (Page generator), [`src/AbstractPageSettings.php`](https://github.com/inerba/filament-db-config/blob/main/src/AbstractPageSettings.php) (Settings page), [`src/DbConfigServiceProvider.php`](https://github.com/inerba/filament-db-config/blob/main/src/DbConfigServiceProvider.php) (Package provider)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_admin["Admin editing"]
  node_page["Settings page"]
  node_widget["Settings widget"]
  node_form["Filament form fields"]
  node_generator["Page generator"]
  node_generated_page["Generated page class<br/>[page.stub]"]
end

subgraph group_runtime["Settings runtime"]
  node_trait["Settings lifecycle<br/>[DbConfigTrait.php]"]
  node_api["DB Config API<br/>[DbConfig.php]"]
  node_helpers["PHP helpers<br/>[helpers.php]"]
  node_facade["Facade<br/>[DbConfig.php]"]
end

subgraph group_state["Persistence and cache"]
  node_migration["Table migration"]
  node_database[("Settings table")]
  node_cache[("Settings cache")]
end

subgraph group_integration["Laravel integration"]
  node_blade["Blade directive"]
  node_provider["Package provider"]
end

node_administrator(("Administrator"))
node_application(("Laravel application"))
node_filament(("Filament admin"))

node_administrator -->|"edits settings"| node_filament
node_filament -->|"hosts page"| node_page
node_page -->|"renders fields"| node_form
node_page -->|"uses lifecycle"| node_trait
node_trait -->|"saves and loads"| node_api
node_administrator -->|"requests page"| node_generator
node_generator -->|"renders stub"| node_generated_page
node_generator -->|"writes class"| node_application
node_provider -->|"registers command"| node_generator
node_provider -->|"registers directive"| node_blade
node_blade -->|"calls get"| node_api
node_application -->|"reads and writes"| node_helpers
node_helpers -->|"delegates access"| node_api
node_facade -->|"resolves API"| node_api
node_api -->|"reads and writes JSON"| node_database
node_api -->|"caches values"| node_cache
node_migration -->|"creates table"| node_database
node_widget -.->|"manages settings"| node_api

click node_page "https://github.com/inerba/filament-db-config/blob/main/src/AbstractPageSettings.php"
click node_widget "https://github.com/inerba/filament-db-config/blob/main/src/AbstractWidgetSettings.php"
click node_generator "https://github.com/inerba/filament-db-config/blob/main/src/Commands/DbConfigCommand.php"
click node_generated_page "https://github.com/inerba/filament-db-config/blob/main/stubs/page.stub"
click node_trait "https://github.com/inerba/filament-db-config/blob/main/src/DbConfigTrait.php"
click node_api "https://github.com/inerba/filament-db-config/blob/main/src/DbConfig.php"
click node_helpers "https://github.com/inerba/filament-db-config/blob/main/src/helpers.php"
click node_facade "https://github.com/inerba/filament-db-config/blob/main/src/Facades/DbConfig.php"
click node_blade "https://github.com/inerba/filament-db-config/blob/main/src/DbConfigServiceProvider.php"
click node_provider "https://github.com/inerba/filament-db-config/blob/main/src/DbConfigServiceProvider.php"
click node_migration "https://github.com/inerba/filament-db-config/blob/main/database/migrations/create_db_config_table.php.stub"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_page,node_widget,node_form,node_generator,node_generated_page toneBlue
class node_trait,node_api,node_helpers,node_facade toneAmber
class node_migration,node_database,node_cache toneMint
class node_blade,node_provider toneRose
class node_administrator,node_application,node_filament toneIndigo
```

## Components

### Admin editing

- [Settings page](https://github.com/inerba/filament-db-config/blob/main/src/AbstractPageSettings.php): `src/AbstractPageSettings.php`
- [Settings widget](https://github.com/inerba/filament-db-config/blob/main/src/AbstractWidgetSettings.php): `src/AbstractWidgetSettings.php`
- **Filament form fields**
- [Page generator](https://github.com/inerba/filament-db-config/blob/main/src/Commands/DbConfigCommand.php): `src/Commands/DbConfigCommand.php`
- [Generated page class](https://github.com/inerba/filament-db-config/blob/main/stubs/page.stub): `stubs/page.stub`

### Settings runtime

- [Settings lifecycle](https://github.com/inerba/filament-db-config/blob/main/src/DbConfigTrait.php): `src/DbConfigTrait.php`
- [DB Config API](https://github.com/inerba/filament-db-config/blob/main/src/DbConfig.php): `src/DbConfig.php`
- [PHP helpers](https://github.com/inerba/filament-db-config/blob/main/src/helpers.php): `src/helpers.php`
- [Facade](https://github.com/inerba/filament-db-config/blob/main/src/Facades/DbConfig.php): `src/Facades/DbConfig.php`

### Persistence and cache

- [Table migration](https://github.com/inerba/filament-db-config/blob/main/database/migrations/create_db_config_table.php.stub): `database/migrations/create_db_config_table.php.stub`
- **Settings table**
- **Settings cache**

### Laravel integration

- [Blade directive](https://github.com/inerba/filament-db-config/blob/main/src/DbConfigServiceProvider.php): `src/DbConfigServiceProvider.php`
- [Package provider](https://github.com/inerba/filament-db-config/blob/main/src/DbConfigServiceProvider.php): `src/DbConfigServiceProvider.php`

### Other components

- **Administrator**
- **Laravel application**
- **Filament admin**

## Connections

- Administrator → Filament admin: edits settings
- Filament admin → Settings page: hosts page
- Settings page → Filament form fields: renders fields
- Settings page → Settings lifecycle: uses lifecycle
- Settings lifecycle → DB Config API: saves and loads
- Administrator → Page generator: requests page
- Page generator → Generated page class: renders stub
- Page generator → Laravel application: writes class
- Package provider → Page generator: registers command
- Package provider → Blade directive: registers directive
- Blade directive → DB Config API: calls get
- Laravel application → PHP helpers: reads and writes
- PHP helpers → DB Config API: delegates access
- Facade → DB Config API: resolves API
- DB Config API → Settings table: reads and writes JSON
- DB Config API → Settings cache: caches values
- Table migration → Settings table: creates table
- Settings widget → DB Config API: manages settings
