承接 jooservices/laravel-config 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jooservices/laravel-config

Composer 安装命令:

composer require jooservices/laravel-config

包简介

Store and retrieve application configuration in database (MongoDB) with caching.

README 文档

README

CI OpenSSF Scorecard PHP Version License: MIT Packagist Version

The JOOservices Laravel Config package stores Laravel application configuration in MongoDB and exposes typed runtime access through JOOservices\\LaravelConfig\\Facades\\Config.

Package name: jooservices/laravel-config

Install

composer require jooservices/laravel-config

Publish configuration:

php artisan vendor:publish --tag=config-store-config

Requirements

  • PHP 8.5+
  • Laravel 12 or 13 (CI-verified)
  • Laravel 11 (constraint-compatible; not CI-verified due to testbench audit constraints)
  • MongoDB via mongodb/laravel-mongodb ^5.4
  • MongoDB PHP extension

What the package does

  • stores values as group, key, value, and type documents in MongoDB
  • loads a full in-memory map on first read and optionally caches that map
  • supports typed normalization for string, int, float, bool, array, json, and null
  • provides runtime get, typed getters, set, forget, remember, group, all, refresh, and fresh operations
  • ships Artisan commands for common operator tasks
  • provides Config::fake() for consumer-app tests without MongoDB

Quick example

use JOOservices\LaravelConfig\Facades\Config;

Config::set('system.site_name', 'XCrawler');
Config::set('system.enabled', true);
Config::set('payment.retry_times', 3);

$siteName = Config::get('system.site_name');
$system = Config::group('system');
$fresh = Config::fresh('system.site_name');

Path format and validation

Paths must use the group.key format.

Rejected values include:

  • empty paths
  • missing dots
  • leading dots
  • trailing dots
  • double dots
  • empty group or empty key segments

Examples:

  • valid: system.site_name
  • valid: payment.retry_times
  • invalid: system
  • invalid: .system.site_name
  • invalid: system.
  • invalid: system..site_name

Cache and memory behavior

  • get, has, group, and all load from memory first
  • when memory is cold, the service reads the cached full map first, then MongoDB on cache miss
  • set and forget update MongoDB, bump a shared cache version stamp, and refresh the cached full map within the current process
  • when a loaded process detects a newer cache version stamp, it reloads from cache or MongoDB before serving reads
  • refresh clears in-memory state and the configured cache key, then reloads from MongoDB
  • fresh bypasses the in-memory map and cache for a direct MongoDB read
  • stored null is returned as null; caller defaults are not applied when the key exists with a null value
  • bool normalization uses PHP filter_var(..., FILTER_VALIDATE_BOOLEAN) semantics

Important limitations:

  • the in-memory map is process-local, so long-running workers can hold stale in-memory state until refresh() is called or the process is recycled
  • each mutation rewrites the full cached map; keep collections config-sized (hundreds of keys, not thousands)
  • use a dedicated cache store/prefix in production; treat the shared cache as a trusted boundary

MongoDB index requirement

Create a unique compound index on group and key so each config path remains unique.

php artisan config-store:ensure-index

Equivalent Mongo shell command:

db.configs.createIndex(
  { group: 1, key: 1 },
  { name: 'config_group_key_unique', unique: true }
);

Artisan commands

php artisan config-store:get system.site_name --default="Default"
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
php artisan config-store:doctor
php artisan config-store:export storage/config-store.json
php artisan config-store:import storage/config-store.json --merge
php artisan config-store:refresh
php artisan config-store:ensure-index

Security note

This package can store sensitive values, but it does not encrypt stored values by default. Do not place credentials or secrets in this store unless your MongoDB deployment, backups, and access controls already satisfy your security requirements.

Upgrade note

The canonical namespace for this package is now JOOservices\\LaravelConfig\\. Existing code that imports JooServices\\LaravelConfig\\... must be updated. This repository does not currently ship a compatibility alias layer.

Documentation

Start with:

AI support

This repository includes AI contributor guidance and skill files.

Start with:

Development

composer lint
composer lint:all
composer test
composer test:coverage
composer check
composer ci

MongoDB must be available for integration tests.

Community

jooservices/laravel-config 适用场景与选型建议

jooservices/laravel-config 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 939 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 14 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「mongodb」 「configuration」 「config」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 jooservices/laravel-config 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 jooservices/laravel-config 我们能提供哪些服务?
定制开发 / 二次开发

基于 jooservices/laravel-config 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 939
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 29
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-14