jooservices / laravel-config
MongoDB-backed application configuration store for Laravel with typed access and caching
Requires
- php: ^8.5
- illuminate/cache: ^12.0|^13.0
- illuminate/config: ^12.0|^13.0
- illuminate/contracts: ^12.0|^13.0
- illuminate/database: ^12.0|^13.0
- illuminate/encryption: ^12.0|^13.0
- illuminate/support: ^12.0|^13.0
- laravel/framework: ^12.0|^13.0
- mongodb/laravel-mongodb: ^5.7
Requires (Dev)
- captainhook/captainhook: ^5.25
- captainhook/plugin-composer: ^5.3
- fakerphp/faker: ^1.24
- friendsofphp/php-cs-fixer: ^3.65
- larastan/larastan: ^3.9
- laravel/pint: ^1.27
- orchestra/testbench: ^10.0|^11.0
- phpmd/phpmd: ^2.15
- phpstan/phpstan: ^2.1
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpunit/phpunit: ^12.0 || ^13.0
- squizlabs/php_codesniffer: ^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-develop
- v4.0.0
- v1.4.0
- v1.3.0
- v1.2.0
- v1.1.0
- 1.0.0
- dev-fix/scorecard-default-branch
- dev-master
- dev-feature/post-v4-runtime-hardening
- dev-chore/adopt-jooservices-standards-v4
- dev-release/1.4.0
- dev-backmerge/v1.3.0-master-to-develop
- dev-release/1.3.0
- dev-feature/audit-remediation-full
- dev-release/1.2.0
- dev-release/1.1.0
- dev-feature/sync-dto-standards-and-config-improvements
This package is auto-updated.
Last update: 2026-09-06 15:33:22 UTC
README
MongoDB-backed typed application configuration for Laravel, with optional cache and Artisan operator commands.
Package: jooservices/laravel-config
v4.0.0includes breaking changes from1.x. See UPGRADE-4.0.md.
Current release: 4.0.0 · Laravel 12/13 · PHP 8.5+
Install
composer require jooservices/laravel-config:^4.0
Publish configuration:
php artisan vendor:publish --tag=config-store-config
Requirements
- PHP 8.5+
- Laravel 12 or 13 only (Laravel 11 dropped)
- MongoDB via
mongodb/laravel-mongodb^5.7 - MongoDB PHP extension
What the package does
- stores values as
group,key,value, andtypedocuments in MongoDB - loads a full in-memory map on first read and optionally caches that map
- typed normalization:
string,int,float,bool,array,json,null, andencrypted(Laravel Crypt) for secrets - nested paths: first segment = group, remainder = key (dots allowed in key),
e.g.
mail.smtp.host - runtime
get, typed getters,set,setMany,forget,forgetMany,clear,remember,listOrdered(normalized),group,all,refresh, andfresh - Artisan commands including import
--dry-run/--forceand CLI--reveal-secrets Config::fake()for consumer-app tests without MongoDB
Prefer JOOservices\LaravelConfig\Facades\Config or the ConfigStore alias —
do not bind this package as Laravel’s native Config.
Quick example
use JOOservices\LaravelConfig\Facades\Config; Config::set('system.site_name', 'XCrawler'); Config::set('system.enabled', true); Config::set('payment.retry_times', 3); Config::set('mail.smtp.host', 'smtp.example.com'); $siteName = Config::get('system.site_name'); $system = Config::group('system'); $fresh = Config::fresh('system.site_name');
Path format
group.key… — first segment is the group; the rest (with dots) is the key.
- valid:
system.site_name,mail.smtp.host - invalid:
system,.system.site_name,system.,system..site_name
Cache and memory behavior
get,has,group, andallload from memory first- cold memory reads the cached full map, then MongoDB on miss
- mutations update MongoDB, bump a shared cache version stamp, and refresh the
process map;
setMany/ bulk import bump once per batch refreshclears memory + cache key and reloads from MongoDBfreshbypasses memory and cache for a direct MongoDB read
Limitations: process-local memory can go stale in long-lived workers; treat the shared cache as a trusted boundary; keep collections config-sized.
MongoDB index
php artisan config-store:ensure-index
Unique compound index on group + key.
Artisan commands
php artisan config-store:get system.site_name --default="Default" php artisan config-store:get system.secret --reveal-secrets php artisan config-store:set system.site_name XCrawler php artisan config-store:set system.enabled true --type=bool php artisan config-store:forget system.site_name php artisan config-store:list system --json --with-types php artisan config-store:doctor php artisan config-store:export storage/config-store.json --reveal-secrets php artisan config-store:import storage/config-store.json --dry-run php artisan config-store:import storage/config-store.json --merge php artisan config-store:import storage/config-store.json --force php artisan config-store:refresh php artisan config-store:ensure-index
Import: use --dry-run to preview. Replace without merge requires --force.
Export/list/get redact encrypted values unless --reveal-secrets.
Security note
Use ConfigType::Encrypted for secrets. ConfigChanged does not embed
plaintext for encrypted values. Access control for MongoDB, backups, and the
cache store remain application responsibilities.
Documentation
- Documentation Hub
- Upgrade to 4.0
- Installation
- Quick Start
- Usage Guide
- Risks, Legacy, and Gaps
- Repo audit vs dto
- Changelog
Development
composer lint
composer lint:all
composer test
composer test:coverage
composer check
composer ci
MongoDB is required for integration tests.