Search by

papi / dotenv

4uruanna

Dotenv Module

dev-main 2026-02-03 14:55 UTC

This package is auto-updated.

Last update: 2026-10-10 00:02:59 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

DotenvEvent is called during BeforeBuild event. 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();