承接 dkm/dotenv-autoload 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dkm/dotenv-autoload

Composer 安装命令:

composer require dkm/dotenv-autoload

包简介

Auto-loads .env then .env.local at Composer autoload time. No plugin, no config.

README 文档

README

Auto-loads .env then .env.local into the environment at Composer autoload time. It replaces helhum/dotenv-connector + a custom adapter package with a single plain library — no Composer plugin, no extra config, no allow-plugins entry, no generated include file.

Install

composer require dkm/dotenv-autoload

That's the whole integration. The package's autoload.files entry runs src/load.php whenever vendor/autoload.php is loaded.

Behaviour

  • Loads <project-root>/.env, then <project-root>/.env.local. .env holds shared defaults; .env.local carries per-instance overrides.
  • Project root is resolved via Composer\InstalledVersions::getRootPackage(), so it works even when this package is installed as a symlinked path repo (where dirname(__DIR__, N) would point into packages/...).
  • Uses Symfony Dotenv load(): a variable already set in the real environment (or in .env) is not overwritten by .env.local. Set DOTENV_OVERRIDE=1 to switch to overload() so .env.local wins.
  • Skips entirely when APP_ENV is already set in the environment.

Boundary (important)

Env vars are exposed when vendor/autoload.php is loaded — i.e. on web requests and in CLI subprocesses (e.g. the typo3 binary invoked from Composer scripts). They are not exposed inline inside the running Composer process.

So this is safe for:

  • application runtime, and
  • Composer scripts that shell out to a binary (typo3 ...).

It is not sufficient for:

  • a Composer plugin, or
  • an inline PHP-callback Composer script ("Vendor\\Class::method"),

that reads these env vars during composer install/update. If you ever add one of those and it needs .env values, keep helhum/dotenv-connector for that project instead.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2026-06-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固