PHPackages                             alexoliverwd/dotenv-loader - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. alexoliverwd/dotenv-loader

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

alexoliverwd/dotenv-loader
==========================

Load environment variables into a PHP application

v1.2.0(6mo ago)01.3kMITPHPPHP &gt;=8.1CI passing

Since May 22Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/aoliverwd/dotenv-loader)[ Packagist](https://packagist.org/packages/alexoliverwd/dotenv-loader)[ RSS](/packages/alexoliverwd-dotenv-loader/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (4)Dependencies (3)Versions (6)Used By (0)

[![PHPUnit](https://github.com/aoliverwd/dotenv-loader/actions/workflows/ci.yml/badge.svg)](https://github.com/aoliverwd/dotenv-loader/actions/workflows/ci.yml/badge.svg) [![Latest Stable Version](https://camo.githubusercontent.com/cc8c46377448f80304fe6c6d8eb51e8c2ebb7c4303f1253de9af75547bb01733/68747470733a2f2f706f7365722e707567782e6f72672f616c65786f6c6976657277642f646f74656e762d6c6f616465722f76)](//packagist.org/packages/alexoliverwd/dotenv-loader) [![License](https://camo.githubusercontent.com/6f96d46b9919c67745118ac8b93b37d16fbf49b1ffba29c0c8ed1c1a68aa1c6b/68747470733a2f2f706f7365722e707567782e6f72672f616c65786f6c6976657277642f646f74656e762d6c6f616465722f6c6963656e7365)](//packagist.org/packages/alexoliverwd/dotenv-loader)

Environment Variables Loader
============================

[](#environment-variables-loader)

Load configuration variables into your PHP application's global namespace from an `.env` file for flexible management across different environments.

Installation
------------

[](#installation)

```
composer require alexoliverwd/dotenv-loader
```

Basic Usage
-----------

[](#basic-usage)

```
\AOWD\envLoader\ResourceLoader::applyEnvironmentVariables(__DIR__ . '/.env');
```

Public Class Methods
--------------------

[](#public-class-methods)

### loadResource

[](#loadresource)

```
loadResource(
	string $resource_location
): array
```

The `loadResource` method retrieves key-value pairs from a configuration file, like `/home/.env`, providing a structured and flexible way to manage application settings across various environments.

### applyEnvironmentVariables

[](#applyenvironmentvariables)

```
applyEnvironmentVariables(
	string $resource_location
): void
```

The `applyEnvironmentVariables` method imports key-value pairs from a configuration file, like `/home/.env`, directly into PHP's global namespace, making them accessible throughout your application using the built-in `$_ENV`[ superglobal variable](https://www.php.net/manual/en/reserved.variables.environment).

### encryptEnvironmentVariables

[](#encryptenvironmentvariables)

```
encryptEnvironmentVariables(
	array $environment_variables,
	string $public_key_content
): array
```

The `encryptEnvironmentVariables` method encrypts the values of the key, value pair array using a provided public key.

### decryptEnvironmentVariables

[](#decryptenvironmentvariables)

```
decryptEnvironmentVariables(
	array $environment_variables,
	string $private_key_content
): array
```

The `decryptEnvironmentVariables` method decrypts the values of the key, value pair array using a provided private key.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance66

Regular maintenance activity

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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

Every ~430 days

Total

4

Last Release

202d ago

PHP version history (2 changes)v1.0.0PHP &gt;=7.4

v1.1.0PHP &gt;=8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2101296?v=4)[Alex Oliver](/maintainers/alexoliverwd)[@alexoliverwd](https://github.com/alexoliverwd)

---

Top Contributors

[![aoliverwd](https://avatars.githubusercontent.com/u/37518812?v=4)](https://github.com/aoliverwd "aoliverwd (11 commits)")

---

Tags

environmentenvdotenvvariablesenvironment variables

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/alexoliverwd-dotenv-loader/health.svg)

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

###  Alternatives

[vlucas/phpdotenv

Loads environment variables from `.env` to `getenv()`, `$\_ENV` and `$\_SERVER` automagically.

13.5k627.3M6.1k](/packages/vlucas-phpdotenv)[symfony/dotenv

Registers environment variables from a .env file

3.8k237.6M2.6k](/packages/symfony-dotenv)[imliam/laravel-env-set-command

Set a .env file variable from the command line

118357.6k10](/packages/imliam-laravel-env-set-command)[msztorc/laravel-env

Laravel env helper commands

7856.7k](/packages/msztorc-laravel-env)[cekurte/environment

A library to get the values from environment variables and process to php data types

5886.2k8](/packages/cekurte-environment)[dotenv-org/phpdotenv-vault

Load environment variables from encrypted .env.vault files

1018.1k2](/packages/dotenv-org-phpdotenv-vault)

PHPackages © 2026

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