PHPackages                             wodcz/nette-dotenv - 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. wodcz/nette-dotenv

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

wodcz/nette-dotenv
==================

dotenv integration into Nette framework

2.0.0(9y ago)810.1k4[1 issues](https://github.com/wodCZ/nette-dotenv/issues)MITPHP

Since Jan 31Pushed 8y ago4 watchersCompare

[ Source](https://github.com/wodCZ/nette-dotenv)[ Packagist](https://packagist.org/packages/wodcz/nette-dotenv)[ Docs](https://github.com/wodCZ/nette-dotenv)[ RSS](/packages/wodcz-nette-dotenv/feed)WikiDiscussions master Synced 3w ago

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

nette-dotenv
============

[](#nette-dotenv)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1d0b57880357846274b939fd23803cb2e363c63047ea7ad3437e0f351a5c3282/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f776f64435a2f6e657474652d646f74656e762e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/wodCZ/nette-dotenv)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/13d6bdc1511fcfd0551c4d33930fb5658a5f7ca91fcfdcfc7faad04ea51dbaf3/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f776f64435a2f6e657474652d646f74656e762f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/wodCZ/nette-dotenv)[![Coverage Status](https://camo.githubusercontent.com/5eb869c786b99fd3826bdcc921a688cb12746654a439eb4304690f0487b60bf2/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f776f64435a2f6e657474652d646f74656e762e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/wodCZ/nette-dotenv/code-structure)[![Quality Score](https://camo.githubusercontent.com/1ebee2869f0583dd7413f887baeb3207c0e11c523263dd7a2aa1704f6a9216b8/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f776f64435a2f6e657474652d646f74656e762e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/wodCZ/nette-dotenv)[![Total Downloads](https://camo.githubusercontent.com/c312392efe2fb1a268e481a37dff596d9cae50a0879e753aff7eb8801c842e8d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f776f64435a2f6e657474652d646f74656e762e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/wodCZ/nette-dotenv)

This little extension helps you to work with environment variables in config.neon. To make it even more convenient, this extension also variables from `.env` file - a feature well known to Laravel users.

Install
-------

[](#install)

Via Composer

```
$ composer require wodcz/nette-dotenv
```

Then register extension in your `config.neon`

```
extensions:
	env: wodCZ\NetteDotenv\DotEnvExtension
```

Usage
-----

[](#usage)

You can access any environment variable using `@env.get('key', 'default')` syntax:

```
services:
    - App/MyConnection(@env::get('DB_HOST', '127.0.0.1'))
```

Environment variables are often set by a `docker`, `docker-compose`, or your CI server. To make working with environment variables even easier, you can specify them in `.env` file in root directory of your application.

This file should be hidden from VCS using `.gitignore` or so, because each developer/server could require different environment configuration. Furthermore, having `.env` file with credentials in repository would be a security risk.

This is an example on how your `.env` file might look like:

```
DB_HOST=192.168.0.10
DB_USER=myprojuser
DB_NAME=myproj
GOOGLE_API_KEY=my_own_key_used_for_development

```

Have a look at [vlucas/phpdotenv documentation](https://github.com/vlucas/phpdotenv) for more comprehensive examples.

Configuration
-------------

[](#configuration)

You can change behavior of this extension using `neon` configuration. Here is a list of available options with their default values.

```
env:
	directory: "%appDir%/../"
	fileName: ".env"
	overload: false
	localOnly: false
	prefix: false
	class: \wodCZ\NetteDotenv\EnvAccessor
```

OptionDescription`directory`Where your `.env` file is located`fileName`Name of your `.env` file`overload`Whether options in the `.env` file should override existing environment variables`localOnly`[Set to true to only return local environment variables (set by the operating system or putenv).](http://php.net/getenv#refsect1-function.getenv-parameters)`prefix`Whether to prefix the service name with the extension name`class`Class used to access environment variablesChange log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Martin Janeček](https://github.com/wodCZ)
- [Vašek Henzl](https://github.com/vhenzl)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 73.3% 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 ~69 days

Total

2

Last Release

3367d ago

Major Versions

1.0.0 → 2.0.02017-04-11

### Community

Maintainers

![](https://www.gravatar.com/avatar/d32171fc60c85c02185f1e59afa90458da96f355fd9bcac41c47423e22fa70f1?d=identicon)[wodCZ](/maintainers/wodCZ)

---

Top Contributors

[![wodCZ](https://avatars.githubusercontent.com/u/1174421?v=4)](https://github.com/wodCZ "wodCZ (11 commits)")[![vhenzl](https://avatars.githubusercontent.com/u/243381?v=4)](https://github.com/vhenzl "vhenzl (3 commits)")[![helvete](https://avatars.githubusercontent.com/u/3540884?v=4)](https://github.com/helvete "helvete (1 commits)")

---

Tags

environment-variablesnettephpnetteenvwodCZnette-dotenv

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/wodcz-nette-dotenv/health.svg)

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

###  Alternatives

[ffraenz/private-composer-installer

A composer install helper for private packages

2321.7M5](/packages/ffraenz-private-composer-installer)[philippbaschke/acf-pro-installer

An install helper for Advanced Custom Fields PRO

278724.6k](/packages/philippbaschke-acf-pro-installer)[bnomei/kirby3-dotenv

Kirby Plugin for environment variables from .env

4147.7k1](/packages/bnomei-kirby3-dotenv)[beebmx/kirby-env

Enable env variables to Kirby

2139.6k2](/packages/beebmx-kirby-env)[aedart/athenaeum

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

245.2k](/packages/aedart-athenaeum)[nystudio107/dotenvy

Speed up your production sites by ditching .env for key/value variable pairs as Apache, Nginx, and shell equivalents.

317.0k](/packages/nystudio107-dotenvy)

PHPackages © 2026

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