Search by

microweber-packages / microweber-config

boksiora

Standalone Laravel config package with per-environment file loading and runtime save support. Enables multi-site configurations by loading config files from environment-specific subdirectories.

Package info

github.com/microweber-packages/microweber-config

Homepage

pkg:composer/microweber-packages/microweber-config

Statistics

Installs: 34

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-11-03 11:17 UTC

This package is auto-updated.

Last update: 2026-11-03 17:06:10 UTC


README

A standalone Laravel package that extends the default config repository with:

  • Per-environment config loading – Loads config files from config/{env}/ directories, enabling multi-site support (e.g., config/my-site.com/)
  • Runtime config saving – Persist config changes back to PHP files at runtime
  • Relative path conversion – Automatically converts absolute storage_path(), database_path(), and base_path() references to portable helper calls when saving

Installation

composer require microweber-packages/microweber-config

The package auto-registers its service provider via Laravel's package discovery.

Usage

Per-environment config loading

Create a subdirectory in your config/ folder named after the environment:

config/
├── app.php          # Base config
├── database.php     # Base config
└── my-site.com/     # Environment-specific overrides
    ├── app.php
    └── database.php

When your app runs with --env=my-site.com, the files in config/my-site.com/ override the base config.

Saving config at runtime

use Illuminate\Support\Facades\Config;

Config::set('microweber.site_name', 'My Site');
Config::save(['microweber']);

Multi-site detection

$config = app('config');
if ($config->isMultisite()) {
    // Environment directory was detected
}

Testing

cd packages/microweber-config
composer install
vendor/bin/phpunit

License

MIT