PHP
Load encrypted .env files in PHP.
Package
Install
Use PIE for the native extension and Composer for the PHP package.
pie install dotenvx/phpdotenvx-ext
composer require dotenvx/phpdotenvx
Usage
Load the .env file alongside index.php before reading variables in your app.
<?php
require __DIR__ . '/vendor/autoload.php';
Dotenvx\Dotenvx::createImmutable(__DIR__)->safeLoad();
See the PHP quickstart for the full encryption workflow.