phillarmonic/crescendo-var-bundle
最新稳定版本:1.0.0
Composer 安装命令:
composer require phillarmonic/crescendo-var-bundle
包简介
Elevate Your Code to a Symphony of Efficiency with CrescendoVarBundle: Where Every Variable Plays its Part Perfectly.
README 文档
README
Elevate Your Code to a Symphony of Efficiency with CrescendoVarBundle: Where Every Variable Plays its Part Perfectly.
Overview
The phillarmonic/crescendo-var-bundle is a Symfony Bundle designed to enhance your development workflow by simplifying environment variable manipulation. With its intuitive features, developers can effortlessly convert environment variable strings into integers or booleans, as well as transform a single environment variable into an array.
This document provides a comprehensive guide on how to integrate and utilize the CrescendoVarBundle in your projects.
This is particularly useful when you need values of a specific type, but your workflow necessitates the use of strings to set your environment variables. An example of this is an ArgoCD YAML file, which requires all values to be strings.
Features
- Automatic Type Conversion: Easily convert string environment variables to integers (
int) or booleans (bool) to ensure the correct data types are used in your application. - Array Transformation: Split a single environment variable into an array, allowing for more complex configurations that can be dynamically adjusted via environment variables.
- Edge Case Handling: Specifically designed to manage edge cases in environment variable processing, ensuring robust and error-free application configuration.
Installation
To install the CrescendoVarBundle, run the following command in your project directory:
composer require phillarmonic/crescendo-var-bundle
Ensure that your project's composer.json is updated and that the package is installed successfully.
Configuration
After installation, configure the bundle by adding it to your application's bundle configuration. This process may vary depending on the framework or platform you are using. Typically, it involves registering the bundle in a configuration file or through an application's bundle registration system.
Usage
CrescendoVarBundle simplifies the usage of environment variables by providing special processors to handle common use cases. Below are examples of how to use these processors in your application:
Converting String to Integer
Use the tryint processor to convert an environment variable value to an integer. This is particularly useful for ports and other numerical configurations.
parameters: database_port: '%env(tryint:DATABASE_PORT)%'
Converting String to Boolean
The trybool processor converts an environment variable value to a boolean. This is ideal for feature flags and other boolean-based configurations.
parameters: second_level_cache_enabled: '%env(trybool:SECOND_LEVEL_CACHE_ENABLED)%'
Explode Environment Variable into an Array
The explode processor splits a single environment variable into an array based on a delimiter (default is coma ,). This is useful for lists of hosts, tags, or any multivalued configuration.
parameters: redis_cluster_hosts: '%env(explode:REDIS_CLUSTER_HOSTS)%' # Setting up your own delimiter redis_cluster_hosts: '%env(explode_;:REDIS_CLUSTER_HOSTS)%'
Support and Contribution
For issues, questions, or contributions, please visit the project's GitHub repository. Our community is eager to help and welcomes contributions from developers at all skill levels.
phillarmonic/crescendo-var-bundle 适用场景与选型建议
phillarmonic/crescendo-var-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.88k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2024 年 03 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 phillarmonic/crescendo-var-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 phillarmonic/crescendo-var-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.88k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-03-12