承接 alpipego/toml-config 相关项目开发

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

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

alpipego/toml-config

Composer 安装命令:

composer require alpipego/toml-config

包简介

TOML adapter for hassankhan/config

README 文档

README

Write your config in .toml files (https://github.com/toml-lang/toml) and use them with https://github.com/hassankhan/config.

Toml Parser used: https://github.com/yosymfony/toml

Config

Supports overloading and uses the first passed-in file as default values.

Interpolation

Supports simple variable interpolation within the same config file:

basepath = "/var/www"
publicpath = "${basepath}/public"
<?php
$config = new Alpipego\TomlConfig\TomlConfig(['tomlfile.toml']);

$config->get('public');
// => `/var/www/public`

This is also possible with arrays. Within the same array a simple notation can be used:

[paths]
base = "/var/www"
public = "${base}/public" # /var/www/public

It's preferable to use the full variable path to avoid conflicts:

[paths]
base = "/var/www"
public = "${paths.base}/public" # /var/www/public

Recursion is possible if the previous values have been expanded:

[paths]
base = "/var/www"
public = "${paths.base}/public" # /var/www/public
assets = "${paths.public}/assets" # /var/www/public/assets

$ENV

The configuration variables are put into environment variables. Array keys (and other complex values) get expanded like:

[paths]
base = "/var/www"

[paths.app]
dir = "${paths.base}/app"

This results in

PATHS_BASE=/var/www
PATHS_APP_DIR=/var/www/app
<?php
getenv('PATHS_APP_DIR'); // '/var/www/app' 
$_ENV('PATHS_APP_DIR'); // '/var/www/app' 

Note: If an env var already exists it does not get overridden.

Write .env file

If you want to use your configuration on your command line, you can write a .env file and source it in your shell:

<?php
$config = new \Alpipego\TomlConfig\TomlConfig(['file1', 'file2']);

$config->writeEnv(__DIR__);

Notes:

  • The path to the .env has to be writable by the webserver
  • This file gets written on every call of the function

alpipego/toml-config 适用场景与选型建议

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-05-03