PHPackages                             tarfin-labs/laravel-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. tarfin-labs/laravel-config

ActiveLibrary

tarfin-labs/laravel-config
==========================

Key value config management for Laravel

v6.0.0(4mo ago)1715.8k↓50%4[1 PRs](https://github.com/tarfin-labs/laravel-config/pulls)MITPHPPHP ^8.1|^8.2|^8.3|^8.4|^8.5CI passing

Since Jan 16Pushed 4mo ago6 watchersCompare

[ Source](https://github.com/tarfin-labs/laravel-config)[ Packagist](https://packagist.org/packages/tarfin-labs/laravel-config)[ Docs](https://github.com/tarfin-labs/laravel-config)[ RSS](/packages/tarfin-labs-laravel-config/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (22)Used By (0)

[![Laravel Config Logo](https://camo.githubusercontent.com/e2e6da07662afbaad148e30253de4cf42caab4af5588d5461a0eec7eb3708f50/68747470733a2f2f73332d65752d776573742d312e616d617a6f6e6177732e636f6d2f6d656469612e74617266696e2e636f6d2f6173736574732f6c6f676f2d636f6e6669672e737667)](https://camo.githubusercontent.com/e2e6da07662afbaad148e30253de4cf42caab4af5588d5461a0eec7eb3708f50/68747470733a2f2f73332d65752d776573742d312e616d617a6f6e6177732e636f6d2f6d656469612e74617266696e2e636f6d2f6173736574732f6c6f676f2d636f6e6669672e737667)

[![Latest Version on Packagist](https://camo.githubusercontent.com/73de051eeb7da73399465423a4e9148c92c6b1d73fcfb302f2c8a07788698010/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f74617266696e2d6c6162732f6c61726176656c2d636f6e6669672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tarfin-labs/laravel-config)[![GitHub Tests Action Status](https://camo.githubusercontent.com/4b84157c6f881b7d54fc2f53542ac086e766b7aee679f9877e9b399ee35eafce/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f74617266696e2d6c6162732f6c61726176656c2d636f6e6669672f74657374732e796d6c3f6272616e63683d6d6173746572266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/tarfin-labs/laravel-config/actions/workflows/tests.yml)[![Total Downloads](https://camo.githubusercontent.com/a6fa9b137b3dcd9de1181f6e6d3acfc4bba8ab69dc63146f5ba4b43617c6e696/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f74617266696e2d6c6162732f6c61726176656c2d636f6e6669672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tarfin-labs/laravel-config)

Introduction
------------

[](#introduction)

Laravel Config provides a database-backed configuration management system for your Laravel application. Store, retrieve, and manage configuration parameters with automatic type casting, tagging support, and nested namespaces.

**Key Features:**

- Database-backed configuration storage
- Automatic type casting (boolean, integer, date, datetime, JSON, custom casters)
- Tag-based organization and retrieval
- Nested namespace support (e.g., `app.mail.host`)
- Facade and helper function access
- Laravel 10, 11, and 12 support

Version Compatibility
---------------------

[](#version-compatibility)

### v6.x (Latest)

[](#v6x-latest)

RequirementVersionsPHP8.1, 8.2, 8.3, 8.4, 8.5Laravel10, 11, 12PHPUnit10, 11, 12### v5.x (Maintenance)

[](#v5x-maintenance)

RequirementVersionsPHP8.1, 8.2, 8.3, 8.4, 8.5Laravel10, 11, 12PHPUnit9.5, 10, 11, 12Installation
------------

[](#installation)

Install the package via Composer:

```
composer require tarfin-labs/laravel-config
```

Publish the configuration and migration files:

```
php artisan vendor:publish --provider="TarfinLabs\LaravelConfig\LaravelConfigServiceProvider" --tag="laravel-config"
```

Run the migrations:

```
php artisan migrate
```

Quick Start
-----------

[](#quick-start)

```
use TarfinLabs\LaravelConfig\Facades\LaravelConfig;
use TarfinLabs\LaravelConfig\Config\ConfigFactory;
use TarfinLabs\LaravelConfig\Enums\ConfigDataType;

// Create a config parameter
$configItem = (new ConfigFactory())
    ->setName('app.debug')
    ->setType(ConfigDataType::BOOLEAN)
    ->setValue(true)
    ->get();

LaravelConfig::create($configItem);

// Get a config value
$debug = LaravelConfig::get('app.debug'); // returns true (boolean)

// Update a config value
LaravelConfig::set('app.debug', false);

// Check if config exists
if (LaravelConfig::has('app.debug')) {
    // ...
}
```

Usage
-----

[](#usage)

### Using the Facade

[](#using-the-facade)

```
use TarfinLabs\LaravelConfig\Facades\LaravelConfig;

// Get a single config value
LaravelConfig::get('key');
LaravelConfig::get('key', 'default'); // with default value

// Set a config value
LaravelConfig::set('key', 'value');

// Check existence
LaravelConfig::has('key');

// Get all configs
LaravelConfig::all();
```

### Creating Config Parameters

[](#creating-config-parameters)

Use `ConfigFactory` to build configuration items:

```
use TarfinLabs\LaravelConfig\Config\ConfigFactory;
use TarfinLabs\LaravelConfig\Enums\ConfigDataType;

$configItem = (new ConfigFactory())
    ->setName('mail.host')
    ->setType(ConfigDataType::STRING)
    ->setValue('smtp.example.com')
    ->setDescription('SMTP server hostname')
    ->setTags(['mail', 'system'])
    ->get();

LaravelConfig::create($configItem);
```

### Supported Data Types

[](#supported-data-types)

The `ConfigDataType` enum provides the following types with automatic casting:

TypeStorageRetrieved As`BOOLEAN``'1'` or `'0'``true` or `false``INTEGER``'123'``123``DATE``'2024-12-25'`Carbon instance`DATE_TIME``'2024-12-25 14:30'`Carbon instance`JSON`JSON stringArray**Custom Casters:**

You can use Laravel's custom cast classes:

```
use Illuminate\Database\Eloquent\Casts\AsCollection;
use Illuminate\Database\Eloquent\Casts\AsEnumCollection;

$configItem = (new ConfigFactory())
    ->setName('allowed.statuses')
    ->setType(AsEnumCollection::class . ':' . StatusEnum::class)
    ->setValue([StatusEnum::Active, StatusEnum::Pending])
    ->get();
```

### Working with Tags

[](#working-with-tags)

Organize configs with tags and retrieve them by tag:

```
// Create configs with tags
$dbHost = (new ConfigFactory())
    ->setName('db.host')
    ->setValue('localhost')
    ->setTags(['database', 'connection'])
    ->get();

$dbPort = (new ConfigFactory())
    ->setName('db.port')
    ->setValue('3306')
    ->setTags(['database', 'connection'])
    ->get();

LaravelConfig::create($dbHost);
LaravelConfig::create($dbPort);

// Get all configs with a specific tag
$databaseConfigs = LaravelConfig::getByTag('database');

// Get configs matching multiple tags
$connectionConfigs = LaravelConfig::getByTag(['database', 'connection']);
```

### Nested Parameters

[](#nested-parameters)

Group related configs using dot notation and retrieve them by namespace:

```
// Create nested configs
LaravelConfig::create((new ConfigFactory())->setName('mail.host')->setValue('smtp.example.com')->get());
LaravelConfig::create((new ConfigFactory())->setName('mail.port')->setValue('587')->get());
LaravelConfig::create((new ConfigFactory())->setName('mail.encryption')->setValue('tls')->get());

// Get all configs under 'mail' namespace
$mailConfigs = LaravelConfig::getNested('mail');

// Returns a Collection with normalized names:
// [
//     ConfigItem { name: 'host', val: 'smtp.example.com' },
//     ConfigItem { name: 'port', val: '587' },
//     ConfigItem { name: 'encryption', val: 'tls' },
// ]
```

### Updating and Deleting

[](#updating-and-deleting)

```
use TarfinLabs\LaravelConfig\Config\Config;

// Update using set() for simple value changes
LaravelConfig::set('app.name', 'New App Name');

// Full update with ConfigFactory
$config = Config::where('name', 'app.name')->first();
$configItem = (new ConfigFactory($config))
    ->setValue('Updated Name')
    ->setDescription('Updated description')
    ->get();

LaravelConfig::update($config, $configItem);

// Delete a config
$config = Config::where('name', 'obsolete.config')->first();
LaravelConfig::delete($config);
```

Helper Functions
----------------

[](#helper-functions)

All facade methods are available as helper functions:

```
// Create
create_config($configItem);

// Read
read_config('key');           // Get single value
read_config();                // Get all configs

// Check existence
has_config('key');

// Update
set_config_value('key', 'new value');  // Quick value update
update_config($config, $configItem);    // Full update

// Delete
delete_config($config);

// Nested
read_nested('mail');  // Get all configs under 'mail' namespace
```

Database Schema
---------------

[](#database-schema)

The package creates a `laravel_config` table with the following structure:

ColumnTypeDescription`id`bigintPrimary key`name`varchar (unique)Configuration parameter name`type`varcharData type (default: 'boolean')`val`varchar (nullable)Configuration value`description`text (nullable)Human-readable description`tags`json (nullable)Array of tags for organization`created_at`timestampCreation timestamp`updated_at`timestampLast update timestampConfiguration
-------------

[](#configuration)

Publish the config file to customize the table name:

```
php artisan vendor:publish --provider="TarfinLabs\LaravelConfig\LaravelConfigServiceProvider" --tag="laravel-config"
```

In `config/laravel-config.php`:

```
return [
    'table' => env('LARAVEL_CONFIG_TABLE', 'laravel_config'),
];
```

Upgrading
---------

[](#upgrading)

### From v5.x to v6.x

[](#from-v5x-to-v6x)

**Breaking Changes:**

1. **Class Renamed**: `LaravelConfig` class is now `ConfigManager`
2. **Facade Moved**: `LaravelConfigFacade` is now `Facades\LaravelConfig`
3. **Version Support**: PHP 8.0 and Laravel 8-9 are no longer supported

**Migration Guide:**

If you were directly instantiating the class:

```
// Before (v5.x)
use TarfinLabs\LaravelConfig\LaravelConfig;
$manager = new LaravelConfig();

// After (v6.x)
use TarfinLabs\LaravelConfig\ConfigManager;
$manager = new ConfigManager();
```

If you were importing the facade directly:

```
// Before (v5.x)
use TarfinLabs\LaravelConfig\LaravelConfigFacade;

// After (v6.x)
use TarfinLabs\LaravelConfig\Facades\LaravelConfig;
```

**No changes required if you:**

- Use the `LaravelConfig` facade alias
- Use helper functions (`read_config()`, `set_config_value()`, etc.)
- Use `app('laravel-config')` container binding

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information about recent changes.

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

[](#contributing)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Security
--------

[](#security)

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

Credits
-------

[](#credits)

- [Turan Karatug](https://github.com/tkaratug)
- [Faruk Can](https://github.com/frkcn)
- [Yunus Emre Deligoz](https://github.com/deligoez)
- [Hakan Ozdemir](https://github.com/hozdemir)
- [All Contributors](../../contributors)

License
-------

[](#license)

Laravel Config is open-sourced software licensed under the [MIT license](LICENSE.md).

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance75

Regular maintenance activity

Popularity35

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

 Bus Factor3

3 contributors hold 50%+ of commits

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 ~108 days

Recently: every ~150 days

Total

21

Last Release

138d ago

Major Versions

1.2.0 → v3.0.02020-10-06

v3.0.0 → 4.0.02021-05-07

v4.7.0 → v5.0.02024-03-05

v5.2.0 → v6.0.02025-12-25

PHP version history (10 changes)1.0.0PHP ^7.2

v3.0.0PHP ^7.3

4.0.0PHP ^7.4

4.1.0PHP ^7.4 || ^8.0

4.5.0PHP ^7.4|^8.0|^8.1

v4.7.0PHP ^7.4|^8.0|^8.1|^8.2

v5.0.0PHP ^8.1|^8.2

v5.1.0PHP ^8.1|^8.2|^8.3

5.2.1PHP ^8.1|^8.2|^8.3|^8.4

v5.2.0PHP ^8.1|^8.2|^8.3|^8.4|^8.5

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/e252316490c5fc7bae7eb25b6c0cb301b49fbc706c32896fea9467b64cf3653b?d=identicon)[Tarfin Labs](/maintainers/Tarfin%20Labs)

---

Top Contributors

[![YunusEmreNalbant](https://avatars.githubusercontent.com/u/29780061?v=4)](https://github.com/YunusEmreNalbant "YunusEmreNalbant (42 commits)")[![frkcn](https://avatars.githubusercontent.com/u/374634?v=4)](https://github.com/frkcn "frkcn (41 commits)")[![deligoez](https://avatars.githubusercontent.com/u/3030815?v=4)](https://github.com/deligoez "deligoez (35 commits)")[![tkaratug](https://avatars.githubusercontent.com/u/4394344?v=4)](https://github.com/tkaratug "tkaratug (30 commits)")[![hozdemir](https://avatars.githubusercontent.com/u/464927?v=4)](https://github.com/hozdemir "hozdemir (26 commits)")[![aydinfatih](https://avatars.githubusercontent.com/u/14280894?v=4)](https://github.com/aydinfatih "aydinfatih (11 commits)")[![mkeremcansev](https://avatars.githubusercontent.com/u/76810832?v=4)](https://github.com/mkeremcansev "mkeremcansev (6 commits)")

---

Tags

key-valuelaravellaravel-configlaravel-optionsphptarfin-labslaravel-config

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tarfin-labs-laravel-config/health.svg)

```
[![Health](https://phpackages.com/badges/tarfin-labs-laravel-config/health.svg)](https://phpackages.com/packages/tarfin-labs-laravel-config)
```

###  Alternatives

[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[tarfin-labs/laravel-spatial

Laravel package to work with geospatial data types and functions.

7285.9k](/packages/tarfin-labs-laravel-spatial)[tarfin-labs/laravel-cloudwatch-logger

Laravel logger for AWS Clouldwatch Log service.

20160.7k](/packages/tarfin-labs-laravel-cloudwatch-logger)[tarfin-labs/netgsm

netgsm channel for laravel

4030.7k](/packages/tarfin-labs-netgsm)[tarfin-labs/easy-pdf

Makes pdf processing easy.

1718.3k](/packages/tarfin-labs-easy-pdf)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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