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

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

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

rmunate/laravel-config-runtime

最新稳定版本:v1.0.0

Composer 安装命令:

composer require rmunate/laravel-config-runtime

包简介

The `LaravelRuntime` Library empowers you to modify Laravel configuration values at runtime. It's essential to note that these changes won't affect the values in the `.env` file; they will only apply while your scripts are running.

README 文档

README

The LaravelRuntime library empowers you to modify Laravel configuration values at runtime. It is essential to note that these changes will not affect the values in the .env file; they will only apply while executing scripts. Now, you can define each script with specific features, select which database to use, set cache methods, authentication settings, email configurations, and all other options.

⚙️ This library is compatible with Laravel versions 8.0 and above ⚙️

Laravel 8.0+ Laravel 9.0+ Laravel 10.0+

logo-laravel-config-runtime

📖 DOCUMENTACIÓN EN ESPAÑOL 📖

Below, we'll demonstrate various possible examples to showcase the extensive usability.

Table of Contents

  1. Installation
  2. Available Methods
  3. Creator
  4. License

Installation

To install the package via Composer, execute the following command:

composer require rmunate/laravel-config-runtime

Available Methods

Here, we'll showcase the possible uses of the library. It's straightforward and incredibly flexible, allowing you to master Laravel configuration with ease.

Get All Configuration Data

If you want to obtain all the current configuration data in an associative array, you can easily do it as follows:

use Rmunate\LaravelConfigRuntime\LaravelRuntime;

// Main method
LaravelRuntime::config()->all();

// Alias of the previous method
LaravelRuntime::config()->get();

Get Configuration of a Specific File

Remember that Laravel has a folder named "config," where various configuration files are stored. This package allows you to define which of these configuration files to consult.

use Rmunate\LaravelConfigRuntime\LaravelRuntime;

// Get the complete configuration status of the defined file
LaravelRuntime::config()->file('app')->get();

Ways to Retrieve Values

Now, if you want to access a specific value from the current Laravel configuration at runtime, you can use any of the following methods:

use Rmunate\LaravelConfigRuntime\LaravelRuntime;

// Define the file and then retrieve the value
LaravelRuntime::config()->file('app')->get('name');

// Without defining the file, use only the get method indicating the full path
LaravelRuntime::config()->get('app.name');

Throw Exception When Value Cannot Be Retrieved

If necessary, you can throw an exception when attempting to retrieve a non-existent value in the framework's configuration.

use Rmunate\LaravelConfigRuntime\LaravelRuntime;

// Define the file and then retrieve the value
LaravelRuntime::config()->file('app')->getOrFail('names');

// Without defining the file, use only the get method indicating the full path
LaravelRuntime::config()->getOrFail('name2');

Retrieve Multiple Values

Thinking about not constantly using the GET method to obtain multiple values, with this query method, you can send the values you want to retrieve simultaneously.

use Rmunate\LaravelConfigRuntime\LaravelRuntime;

// You can send an array or simply the values you require separated by commas.
LaravelRuntime::config()->getMany('app.name', 'cache.default');
LaravelRuntime::config()->getMany(['app.name', 'cache.default']);

Validate Existence of Configuration Value

If it's essential to check if a configuration value exists, then this method makes it very easy.

use Rmunate\LaravelConfigRuntime\LaravelRuntime;

// You can send the full route of the value to search for.
LaravelRuntime::config()->has('app.name');

// You can also define the file to search in.
LaravelRuntime::config()->file('app')->has('name');

Validate Existence of Multiple Configuration Values

If you want to validate multiple configuration values, then this might be the method you need. Note that you CANNOT define the file to query here because using the full path of the value allows you to validate multiple files simultaneously.

use Rmunate\LaravelConfigRuntime\LaravelRuntime;

// You can send an array or simply the full paths separated by commas.
LaravelRuntime::config()->hasMany('app.name', 'cache.default');
LaravelRuntime::config()->hasMany(['app.name', 'cache.default']);

Change Configuration Value

This is very useful; you can change any configuration value at runtime by simply defining what you require. Need to change the database connection? Want to use a custom email for notifications? Well, in that case, this is the solution.

use Rmunate\LaravelConfigRuntime\LaravelRuntime;

// You can send an array or simply the full paths separated by commas.
LaravelRuntime::config()->file('mail')->set('mailers.smtp.username', 'xxxx@xxxx.com');
LaravelRuntime::config()->file('mail')->set('mailers.smtp.password', 'xxxxxxx');

// You can also change values without defining the file to intervene.
LaravelRuntime::config()->set('app.name', 'CodeMaestro');

Delete Configuration Value

Well, this is something only you know if you need. If you do, well, here it is, quick and easy.

use Rmunate\LaravelConfigRuntime\LaravelRuntime;

// You can define the file to use if you wish; this property will be set to null while the script finishes.
LaravelRuntime::config()->file('app')->unset('name');
LaravelRuntime::config()->unset('app.name');

Creator

License

This project is under the MIT License.

🌟 Support My Projects! 🚀

Make any contributions you see fit; the code is entirely yours. Together, we can do amazing things and improve the world of development. Your support is invaluable. ✨

If you have ideas, suggestions, or just want to collaborate, we are open to everything! Join our community and be part of our journey to success! 🌐👩‍💻👨‍💻

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

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

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 117
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 18
  • 点击次数: 16
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 18
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-07-25