papi / dotenv
Dotenv Module
dev-main
2026-02-03 14:55 UTC
Requires
- php: >=8.5.0
- papi/core: ^1.0
- vlucas/phpdotenv: ^5.6.3
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.93
- phpunit/phpunit: ^12.5
This package is auto-updated.
Last update: 2026-03-04 17:26:29 UTC
README
PACKAGIST | GITHUB
Description
Load environment (.env) when building your PAPI.
This module uses gitvlucas/phpdotenv under the hood.
Configuration
Constants
| Name | Required | Type | Default | Description |
|---|---|---|---|---|
DOTENV_PATH |
No | String | ".env" |
Directory where the .env file to load is located |
Usage
DotenvEventis called duringBeforeBuildevent. We recommend putting it first to avoid any mistakes.
use PAPI\Core\SlimBuilder; use PAPI\Mod\Dotenv\DotenvEvent; define("DOTENV_PATH", __DIR__ . DIRECTORY_SEPARATOR . ".env"); $builder = new SlimBuilder(); $builder ->addEvent(DotenvEvent::class) ->build() ->run();