beebmx/kirby-env
Composer 安装命令:
composer require beebmx/kirby-env
包简介
Enable env variables to Kirby
README 文档
README
Env use the vlucas/phpdotenv package and enable their features for Kirby.
This package should be used if you want to store your project credentials or variables in a separate place from your code or if you want to have development and production access in different places.
Installation
Installation with composer
composer require beebmx/kirby-env
Usage
You don't need to do anything if your want to access in any $page, just use the page method:
$page->env('VAR');
But if you want to set variables in your config.php file, first you need to load the object with:
\Beebmx\KirbyEnv::load('main/path');
You need to have an .env file in your main/path directory.
You can store any credentials or variables secure like:
KIRBY_DEBUG=false
SECRET_KEY=my_secret_key
PUBLIC_KEY=my_public_key
FOO=BAR
BAZ=${FOO}
Options
When you create an instance of \Beebmx\KirbyEnv you need to load the environment with:
\Beebmx\KirbyEnv::load();
If you require the immutability provided by vlucas/phpdotenv, just:
\Beebmx\KirbyEnv::overload();
Example
Here's an example of a configuration in config.phpfile:
<?php \Beebmx\KirbyEnv::load('main/path'); return [ 'debug' => env('KIRBY_DEBUG', false), 'SECRET' => env('SECRET_KEY'), 'PUBLIC' => env('PUBLIC_KEY'), ];
Usage note
It is important that you add to your .gitignore the .env file.
The main/path is where the .env file is located.
beebmx/kirby-env 适用场景与选型建议
beebmx/kirby-env 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 39.96k 次下载、GitHub Stars 达 20, 最近一次更新时间为 2019 年 01 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「env」 「dotenv」 「kirby」 「phpdotenv」 「kirby-plugin」 「kirby4」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 beebmx/kirby-env 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 beebmx/kirby-env 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 beebmx/kirby-env 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
An environment variable convenience library extension for vlucas/phpdotenv
Zero-dependency global `kirbylog()` helper for any content
Courier offers a convenient and painless solution for creating emails tailored for your Kirby website.
Laravel dotenv manager
Blade template for Kirby
Utils to load, parse and work with configuration on Mezzio projects
统计信息
- 总下载量: 39.96k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 20
- 点击次数: 19
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-01-21