承接 quillstack/dotenv 相关项目开发

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

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

quillstack/dotenv

Composer 安装命令:

composer require quillstack/dotenv

包简介

The library for using .env files.

README 文档

README

Build Status Downloads Coverage Lines of Code StyleCI CodeFactor Packagist License Reliability Rating Maintainability Security Rating Packagist PHP Version Support

The library for using .env files. You can find the full documentation on the website:
https://quillstack.org/dotenv

The .env should be used for sensitive information like passwords, hosts, keys, credentials, and all other values that can be changed depending on the environment, e.g., debug mode settings or logs level.

Installation

To install this package, run the standard command using Composer:

composer require quillstack/dotenv

Usage

You can use Quillstack Dotenv package when you want to use .env files in your project.

Simple usage

If you created the .env file in the root directory of your proejct:

APP_DEBUG=true

You can load this .env file in your application:

$dotenv = new Dotenv('.env');
$dotenv->load();

Every time you need to know if your application works in debug mode, you can check it using this helper function:

if (env('APP_DEBUG')) {
    echo 'Debug mode';
}

Default values

You can also define a default value depending on the context:

if (env('APP_DEBUG', false)) {
    echo 'Debug mode';
}

Required keys

You can use another helper method for required keys. If required key is not found an exception will be thrown:

$dbHost = required('DATABASE_HOST');

The result if the key DATABASE_HOST is not set in the .env file:

DotenvValueNotSetException:
Value not set for key: DATABASE_HOST

Multi-line values

You can define multi-line values in your .env file by using \n separator instead of new lines for example:

PRIVATE_KEY="line1\nline2\nline3"

Unit tests

Run tests using a command:

phpdbg -qrr ./vendor/bin/unit-tests

Docker

$ docker-compose up -d
$ docker exec -w /var/www/html -it quillstack_dotenv sh

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-10-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固