datahihi1/tiny-env-validator

Validation helpers for tiny-env: rules and helpers to validate .env values

Installs: 0

Dependents: 0

Suggesters: 1

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/datahihi1/tiny-env-validator

1.0.0 2025-10-05 07:24 UTC

This package is auto-updated.

Last update: 2025-10-10 15:30:22 UTC


README

Validation helpers for tiny-env — simple rules and helpers to validate .env values.

Installation

composer require datahihi1/tiny-env-validator:^1.0

Usage (example)

Assuming tiny-env is loaded:

require 'vendor/autoload.php';

// procedural helper
validate_env([
  'APP_ENV'   => 'required|string',
  'DB_PORT'   => 'required|int',
  'APP_DEBUG' => 'bool'
]);

// or using a Validator class (if available)
// $validator = new Datahihi1\TinyEnv\Validator([...rules...]);
// $validator->validate();

Features

  • Common validation rules: required, string, int, float, bool, email, in, regex...
  • Simple helper wrappers for quick checks
  • Designed to integrate with tiny-env

Examples

validate_env([
  'VERSION' => 'required|string',
  'DB_PORT' => 'int',
  'APP_DEBUG' => 'bool'
]);

Contributing

PRs welcome. Follow coding style and include tests for new rules.

License

MIT