Download the PHP package tarfin-labs/laravel-config without Composer
On this page you can find all versions of the php package tarfin-labs/laravel-config. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tarfin-labs/laravel-config
More information about tarfin-labs/laravel-config
Files in tarfin-labs/laravel-config
Package laravel-config
Short Description Key value config management for Laravel
License MIT
Homepage https://github.com/tarfin-labs/laravel-config
Informations about the package laravel-config
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
v6.x (Latest)
| Requirement | Versions |
|---|---|
| PHP | 8.1, 8.2, 8.3, 8.4, 8.5 |
| Laravel | 10, 11, 12 |
| PHPUnit | 10, 11, 12 |
v5.x (Maintenance)
| Requirement | Versions |
|---|---|
| PHP | 8.1, 8.2, 8.3, 8.4, 8.5 |
| Laravel | 10, 11, 12 |
| PHPUnit | 9.5, 10, 11, 12 |
Installation
Install the package via Composer:
Publish the configuration and migration files:
Run the migrations:
Quick Start
Usage
Using the Facade
Creating Config Parameters
Use ConfigFactory to build configuration items:
Supported Data Types
The ConfigDataType enum provides the following types with automatic casting:
| Type | Storage | Retrieved 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 string | Array |
Custom Casters:
You can use Laravel's custom cast classes:
Working with Tags
Organize configs with tags and retrieve them by tag:
Nested Parameters
Group related configs using dot notation and retrieve them by namespace:
Updating and Deleting
Helper Functions
All facade methods are available as helper functions:
Database Schema
The package creates a laravel_config table with the following structure:
| Column | Type | Description |
|---|---|---|
id |
bigint | Primary key |
name |
varchar (unique) | Configuration parameter name |
type |
varchar | Data type (default: 'boolean') |
val |
varchar (nullable) | Configuration value |
description |
text (nullable) | Human-readable description |
tags |
json (nullable) | Array of tags for organization |
created_at |
timestamp | Creation timestamp |
updated_at |
timestamp | Last update timestamp |
Configuration
Publish the config file to customize the table name:
In config/laravel-config.php:
Upgrading
From v5.x to v6.x
Breaking Changes:
- Class Renamed:
LaravelConfigclass is nowConfigManager - Facade Moved:
LaravelConfigFacadeis nowFacades\LaravelConfig - Version Support: PHP 8.0 and Laravel 8-9 are no longer supported
Migration Guide:
If you were directly instantiating the class:
If you were importing the facade directly:
No changes required if you:
- Use the
LaravelConfigfacade alias - Use helper functions (
read_config(),set_config_value(), etc.) - Use
app('laravel-config')container binding
Testing
Changelog
Please see CHANGELOG for more information about recent changes.
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
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
Credits
- Turan Karatug
- Faruk Can
- Yunus Emre Deligoz
- Hakan Ozdemir
- All Contributors
License
Laravel Config is open-sourced software licensed under the MIT license.