sven/env-providers
Env Providers lets Laravel apps register service providers conditionally by environment, so local, staging, and production-only providers can live outside config/app.php and load automatically based on APP_ENV.
if (app()->environment('local')) checks. This turns "which providers run where" into reviewable configuration instead of hidden control flow.$this->app->register()). The decision is therefore not "can we build it" but "do we want a shared, documented convention for it." Buying/adopting costs nothing (MIT), but earns a micro-dependency; building earns ownership and zero vendor risk. v4.2.0 does not change this calculus — it is a compatibility release, not new capability.env() calls inside config/app.php — a recurring source of production breakage after php artisan config:cache. This is a reliability decision as much as an ergonomics one.testing environment lean and deterministic — directly supports roadmap work on CI duration and flaky-test reduction.Adopt when:
AppServiceProvider::register() is clearer and dependency-free.env()-dependent conditionals, or you have been bitten by config caching.Look elsewhere or skip when:
bootstrap/app.php registration surface (->withProviders()) and want a single, framework-native place to declare providers. The package's original premise assumes a config/app.php providers array; confirm exactly where and how it hooks in under Laravel 11 before adopting, since two registration surfaces is worse than one.For executives: A small, free (MIT) utility that lets us declare which Laravel service providers load in which environment. It removes a class of production incidents — dev tooling or test-only integrations booting where they shouldn't — and fixes a known fragility around config caching. The v4.2.0 release is a low-risk compatibility update: it adds Laravel 11 support, which means the convention survives our framework upgrade instead of being thrown away, and it carries no breaking changes. Cost remains effectively zero, there is no infrastructure change, and it is removable in an afternoon. The caveats are unchanged: low-adoption community package, single maintainer, and a release history that is mostly automated dependency bumps — so we pin the version and keep a ~40-line in-house fallback ready.
For engineering: v4.2.0 is a minor release — Dependabot CI bumps plus Laravel 11 compatibility (PR #70). Upgrade is a composer bump with no migration work. The architectural point stands: move environment-conditional providers out of config/app.php / AppServiceProvider into a dedicated config file keyed by environment. Benefits: config stays cache-safe (no env() at config load), provider registration becomes declarative and diff-reviewable, and the testing environment stops booting heavyweight providers. Two things to check on the way in: (1) on Laravel 11 the provider list lives in bootstrap/app.php, so confirm the package's entry point doesn't leave you maintaining providers in two places; (2) provider ordering relative to other providers — boot order affects event listeners and bindings. Migration is mechanical — list the providers, delete the conditionals — and rollback is reverting one file.
Ask: A half-day spike to move our existing environment-conditional providers behind this config on the v4.2.0 tag, with a documented fallback path if the package goes stale again.
How can I help you explore Laravel packages today?