承接 linkorb/envoi 相关项目开发

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

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

linkorb/envoi

Composer 安装命令:

composer require linkorb/envoi

包简介

Environment variables on steroids

关键字:

README 文档

README

envoi

Envoi aims to ease the use and documentation of environment variables (env vars) in PHP applications.

Envoi features:

  • a Yaml schema to describe the env vars that may be used to configure an application

  • tools to validate env vars against a schema

  • a tool to assist in the population of a .env file

  • a tool which converts a schema to markdown

Envoi sports a console command which validates a .env file against a schema (by convention, .env.yaml). It also provides checkers that, when invoked early in the start-up phase of an application, will halt an application which doesn't have a complete and valid set of env vars.

Install

composer require linkorb/envoi

Use

Env Checkers

A checker should be invoked as early as possible in the life-cycle of an application. The ideal time is immediately after the environment has been populated with env vars. For example, in a Symfony-based app, the checker should be invoked right after the Dotenv component has loaded the env vars from the various .env* files:

<?php

// config/bootstrap.php

use Envoi\EnvChecker;
use Symfony\Component\Dotenv\Dotenv;

require dirname(__DIR__).'/vendor/autoload.php';

(new Dotenv(false))->loadEnv(dirname(__DIR__).'/.env');
// check the env!
(new EnvChecker())->check(dirname(__DIR__).'/.env.yaml');

The checker will throw an exception to halt the application when invalid env vars are found. The list of validation errors is included in the exception message.

EnvChecker treats the environment as immutable: it validates env vars, but does not modify them. MutableEnvChecker validates env vars and can also transform values, making it the ideal checker when you want to take advantage of the various env var transformation features of Envoi.

Interpolation

Assign one variable based on another in .env file

FOO="foo"
BAR="{FOO}/logs"

Metadata environment example .env.yaml Supports types: int, string, url, path

FOO:
  description: Used to configure foo system
  type: url
  default: "https://username:password@example.com/bla"
  required: true
QUX:
  description: path to qux files
  type: path
  example: "some example value"
  make-absolute-path: true  #  "Expands  relative paths to absolute paths (i.e. ~/qux becomes /home/joe/qux)
BAR:
  description: Used for bar things
  type: string
  options: RED,GREEN,BLUE # validates that input is one of the available options

Init environment variables from .env

Envoi::init();
$foo = getenv('FOO');

CLI

./vendor/bin/envoi

Available commands:

validate Validate based on meta file .env.yaml.
configure CLI wizard to ask + update .env file based on .env.yaml.
markdown Output a GitHub Flavored Markdown documentation for the available variables. Look for a <!-- envoi start --> and <!-- envoi end --> tags in file (default to README.md), and insert/update the generated markdown between those tags.

Run tests

./vendor/bin/phpunit

Contributing

We welcome contributions to make this repository even better. Whether it's fixing a bug, adding a feature, or improving documentation, your help is highly appreciated. To get started, fork this repository then clone your fork.

Be sure to familiarize yourself with LinkORB's Contribution Guidelines for our standards around commits, branches, and pull requests, as well as our code of conduct before submitting any changes.

If you are unable to implement changes you like yourself, don't hesitate to open a new issue report so that we or others may take care of it.

Brought to you by the LinkORB Engineering team


Check out our other projects at linkorb.com/engineering. By the way, we're hiring!

linkorb/envoi 适用场景与选型建议

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

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

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

围绕 linkorb/envoi 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

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