定制 beebmx/kirby-env 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

beebmx/kirby-env

最新稳定版本:5.1.0

Composer 安装命令:

composer require beebmx/kirby-env

包简介

Enable env variables to Kirby

README 文档

README

Latest Stable Version GitHub Workflow Status Total Downloads License

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.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-01-21