Download the PHP package phpdevcommunity/php-dotenv without Composer

On this page you can find all versions of the php package phpdevcommunity/php-dotenv. 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 php-dotenv

⚠️ Abandoned package

This package is abandoned and no longer maintained.
The author suggests using michel/dotenv instead.

PHP-DotEnv

PHP-DotEnv is a lightweight and robust PHP library designed to simplify the management of environment variables in your PHP applications. It parses a .env file and loads the variables into getenv(), $_ENV, and $_SERVER.

It comes with a powerful processor system that automatically converts values (booleans, nulls, numbers) and allows you to define your own custom processors for specific needs.


English Documentation

Installation

Requires PHP 7.4 or higher.

Install via Composer:

Basic Usage

  1. Create a .env file in your project root:

  2. Load the variables in your PHP entry point (e.g., index.php):

Features

1. Automatic Type Conversion (Default Processors)

PHP-DotEnv automatically processes values using default processors:

2. Comments

Lines starting with # are treated as comments and ignored.

3. Trimming

Keys and values are automatically trimmed of whitespace.

Advanced Usage: Custom Processors

You can extend the functionality by creating custom processors. A processor must extend PhpDevCommunity\Processor\AbstractProcessor.

Creating a Custom Processor

Example: A processor that converts comma-separated strings into arrays.

Registering Custom Processors

Pass an array of processor class names to the DotEnv constructor. Note: When you pass custom processors, you must also include the default ones if you still want them to run.


🇫🇷 Documentation Française

Introduction

PHP-DotEnv est une bibliothèque PHP légère conçue pour simplifier la gestion des variables d'environnement dans vos applications PHP. Elle analyse un fichier .env et charge les variables dans getenv(), $_ENV et $_SERVER.

Elle intègre un système de processeurs qui convertit automatiquement les valeurs (booléens, null, nombres) et vous permet de définir vos propres processeurs personnalisés.

Installation

Nécessite PHP 7.4 ou supérieur.

Installez via Composer :

Utilisation de Base

  1. Créez un fichier .env à la racine de votre projet :

  2. Chargez les variables dans votre point d'entrée PHP (ex: index.php) :

Fonctionnalités

1. Conversion Automatique des Types (Processeurs par défaut)

PHP-DotEnv traite automatiquement les valeurs à l'aide de processeurs par défaut :

2. Commentaires

Les lignes commençant par # sont traitées comme des commentaires et ignorées.

3. Nettoyage (Trimming)

Les espaces autour des clés et des valeurs sont automatiquement supprimés.

Utilisation Avancée : Processeurs Personnalisés

Vous pouvez étendre les fonctionnalités en créant des processeurs personnalisés. Un processeur doit étendre PhpDevCommunity\Processor\AbstractProcessor.

Créer un Processeur Personnalisé

Exemple : Un processeur qui convertit les chaînes séparées par des virgules en tableaux.

Enregistrer les Processeurs Personnalisés

Passez un tableau de noms de classes de processeurs au constructeur de DotEnv. Note : Lorsque vous passez des processeurs personnalisés, vous devez également inclure ceux par défaut si vous souhaitez qu'ils continuent de fonctionner.


All versions of php-dotenv with dependencies

PHP Build Version
Package Version
Requires php Version >=7.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 phpdevcommunity/php-dotenv contains the following files

Loading the files please wait ...