PHPackages                             principles/principles - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. principles/principles

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

principles/principles
=====================

Validate your env variables.

0.0.1(1y ago)13MITPHP

Since Oct 7Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Haberkamp/principles)[ Packagist](https://packagist.org/packages/principles/principles)[ RSS](/packages/principles-principles/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

📦 Principles
============

[](#-principles)

Validate your .env file and save yourself some headaches.

🌟 Highlights
------------

[](#-highlights)

- Validates your .env file
- CLI and programmatic usage

ℹ️ Overview
-----------

[](#ℹ️-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

[](#️-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
-------

[](#-usage)

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

### CLI

[](#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](https://github.com/rakit/validation?tab=readme-ov-file#available-rules)contains all of them.

Then run the following command:

```
./vendor/bin/principles
```

### Programmatic

[](#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
---------------

[](#️-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
---------------------------

[](#-feedback-and-contributing)

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

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

588d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2505414eaca742ee34cbdca744a3ff2438b07230f91ca580f7a5b4eaf0d6a71d?d=identicon)[Haberkamp](/maintainers/Haberkamp)

---

Top Contributors

[![Haberkamp](https://avatars.githubusercontent.com/u/35109813?v=4)](https://github.com/Haberkamp "Haberkamp (12 commits)")

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/principles-principles/health.svg)

```
[![Health](https://phpackages.com/badges/principles-principles/health.svg)](https://phpackages.com/packages/principles-principles)
```

###  Alternatives

[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
