Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Env Polyfill Laravel Package

phpexperts/laravel-env-polyfill

A lightweight polyfill that brings Laravel's env() helper and .env file loading to any PHP project. Read environment variables with Laravel-style syntax and sensible type casting, no framework required.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Build vs. buy (or rather, build vs. vendor 30 lines of code): This package is a compatibility shim that restores the pre-5.8 Laravel env() behavior ($_ENV / $_SERVER / getenv() lookup) outside a Laravel application. The real decision it informs is whether to adopt a third-party dependency or inline a small helper. Given the signals (5 stars, 0 dependents, NOASSERTION license, single maintainer), the correct framing is "vendor or fork," not "adopt as a platform dependency."
  • Strangler-fig migrations off Laravel: If you are extracting services, CLI scripts, queue workers, or shared libraries out of a Laravel monolith, this lets legacy code keep calling env() unchanged while you migrate incrementally. That is a schedule/risk trade: fewer touched files per PR versus a temporary dependency with unclear licensing.
  • Standardizing config access across mixed stacks: Useful when a team already has Laravel muscle memory and wants the same DX in standalone PHP tools, WordPress plugins, or Slim/Silex-adjacent scripts—without pulling in the full framework.
  • Prototyping and internal tooling: Low-cost way to unblock a spike or an internal script. It should not be a roadmap input; opportunity: 14.2 and an overall score of 0.085 indicate a utility with essentially no strategic upside.
  • Explicit non-decision: It does not support decisions around typed configuration, config validation, secrets management, or hot-reload. If those are on the roadmap, this package is a distraction.

When to Consider This Package

Adopt (with guardrails) when all of the following hold:

  • You have an existing codebase that already relies on pre-5.8 Laravel env() semantics and rewriting those call sites is genuinely expensive.
  • The usage is confined to bootstrapping/configuration, not scattered through business logic—env() outside config files is exactly what Laravel itself deprecated, and config caching makes runtime env() reads unreliable.
  • You can clear the NOASSERTION license with legal, or you are prepared to reimplement the behavior in-house (it is small and well-understood).
  • You pin the version, wrap it behind your own Config/Env facade, and have a removal date.

Look elsewhere when:

  • Greenfield projects: use vlucas/phpdotenv (v4/v5) or symfony/dotenv directly. They are actively maintained, permissively licensed, and have real dependent counts.
  • Production systems with compliance or supply-chain requirements: an unasserted license plus one maintainer plus zero dependents is a poor audit story.
  • You need more than env(): typed config objects, schema validation, secret backends (Vault, AWS Secrets Manager), or multi-environment precedence rules—none of which this provides.
  • The team expects long-term maintenance: assume abandonment and budget for it.

How to Pitch It (Stakeholders)

For executives: This is not a strategic dependency; it is glue. It costs almost nothing to trial and lets us move legacy code out of the monolith without rewriting every configuration call on day one. We should cap the exposure: time-box it to the migration, keep it behind an internal wrapper, and treat the license as an open item for legal before it touches production.

For engineering: Small polyfill that restores Laravel's pre-5.8 env() semantics for non-Laravel code. It is a bridge, not a foundation—expect no upstream support. Use it only at bootstrap/config boundaries, never in request-path business logic, and never rely on it when config caching is in play. Preferred alternative for anything new is phpdotenv or symfony/dotenv; if we adopt this, we fork it, pin it, and schedule its removal.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource