承接 principles/principles 相关项目开发

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

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

principles/principles

最新稳定版本:0.0.1

Composer 安装命令:

composer require principles/principles

包简介

Validate your env variables.

README 文档

README

Validate your .env file and save yourself some headaches.

🌟 Highlights

  • Validates your .env file
  • CLI and programmatic usage

ℹ️ Overview

Missing environment variables or incorrect value can cause some nasty bugs. Principles helps you to avoid those bugs by validating your .env file, saving you time and headaches.

✍️ Authors

Hi my name is Nils, I like to create things that make life easier. Creating a package that validates .env files is one of those things.

🚀 Usage

There are two ways to use this package: CLI and programmatic.

CLI

In the root of your project create a principles.json file. This file contains all the env variables you want to validate.

{
  "MY_ENV_VAR": "required|string"
}

There are many rules you can use to validate your env variables. This list contains all of them.

Then run the following command:

./vendor/bin/principles

Programmatic

// Either define the rules here or load them from a file
$rules = [
    'MY_ENV_VAR' => 'required|string',
];

$validation = new \Principles\EnvValidator($rules);

$validation->validate();

if ($validation->fails()) {
  // TODO: handle errors
}

⬇️ Installation

Use composer to add this package to the development dependencies of your project.

composer require principles/principles --require-dev

Requirements: PHP 7.4 or higher

💭 Feedback and Contributing

If you have any suggestions or improvements, please open an issue or a pull request. I welcome any feedback.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-07