Download the PHP package dev-kraken/env-validator without Composer

On this page you can find all versions of the php package dev-kraken/env-validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package env-validator

EnvValidator

Type-safe environment variable validation for Laravel and PHP applications

Latest Version on Packagist Total Downloads Build Status License PHP Version Tests

EnvValidator is a modern, type-safe PHP package for validating environment variables in Laravel and standalone PHP applications. It provides robust validation with clear error messages, intelligent presets, extensible rule objects, and automatic environment file synchronization.

:sparkles: Features

:rocket: Quick Start

Installation

You can publish the configuration file with:

Laravel Usage

Standalone PHP Usage

Basic Example (String Rules)

Advanced Example (Rule Objects)

Required Field Validation

EnvValidator properly handles required field validation in both Laravel and standalone PHP environments:

Required fields fail validation when they are:

:clipboard: Built-in Rule Presets

Preset Description Use Case
laravel Complete Laravel application Full-featured web applications
minimal Essential variables only Microservices, lightweight apps
production Production-ready settings Deployment environments
api API-focused applications REST APIs, headless applications
microservice Microservice-specific Containerized services
docker Docker/containerized apps Container deployments

Preset Usage Examples

:dart: Rule Objects vs String Rules

EnvValidator uses Rule objects for better type safety and maintainability:

:white_check_mark: Rule Objects (Recommended)

Benefits:

:books: Available Rule Objects

String Rules

Numeric Rules

Network Rules

:hammer_and_wrench: Advanced Usage

Custom Rules

Environment-Specific Validation

Conditional Validation

:art: Laravel Integration

Artisan Commands

:arrows_counterclockwise: Environment File Synchronization

Keep your .env and .env.example files synchronized automatically! This feature helps prevent deployment issues when developers add new environment variables but forget to update the example file.

:mag: Check Synchronization Status

Sample Output:

:gear: Synchronization Commands

:shield: Security Features

The sync command automatically handles sensitive data:

:building_construction: Integration with CI/CD

Add environment sync checks to your deployment pipeline:

:computer: Programmatic Usage

:computer: Standalone PHP Usage

The environment sync feature works perfectly in standalone PHP applications (without Laravel):

Different Project Structures

Deployment Script Integration

:bulb: Best Practices

Laravel Projects

  1. Before Deployments: Always run php artisan env:sync --check
  2. In Development: Use php artisan env:sync when adding new variables
  3. Team Workflow:
    • Add new variables to .env
    • Run php artisan env:sync
    • Commit both .env.example and updated validation rules
  4. CI/CD Integration: Fail builds if files are out of sync
  5. Security: Use --no-values flag for highly sensitive projects

Standalone PHP Projects

  1. Always specify absolute paths: Use __DIR__ or getcwd() for reliable paths
  2. Check file existence: Use $syncService->envFileExists() before operations
  3. Handle errors gracefully: Always check $result['success'] before proceeding
  4. Integrate with deployment: Add sync checks to your deployment scripts
  5. Combine with validation: Use sync + validation for complete environment safety

Service Provider Configuration

Facade Usage

:test_tube: Testing

Running Tests

Code Quality

:book: Examples

The examples/ directory contains comprehensive examples demonstrating various use cases:

Real-World Scenarios

Running Examples

:handshake: Contributing

We welcome contributions! Please see CONTRIBUTING.md for details.

Development Setup

:page_facing_up: License

The MIT License (MIT). Please see License File for more information.

:lock: Security

If you discover any security vulnerabilities, please send an email to [email protected] instead of using the issue tracker.

:telephone_receiver: Support


Made with :heart: by Dev Kraken


All versions of env-validator with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
vlucas/phpdotenv Version ^5.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dev-kraken/env-validator contains the following files

Loading the files please wait ....