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.
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."env() unchanged while you migrate incrementally. That is a schedule/risk trade: fewer touched files per PR versus a temporary dependency with unclear licensing.opportunity: 14.2 and an overall score of 0.085 indicate a utility with essentially no strategic upside.Adopt (with guardrails) when all of the following hold:
env() semantics and rewriting those call sites is genuinely expensive.env() outside config files is exactly what Laravel itself deprecated, and config caching makes runtime env() reads unreliable.NOASSERTION license with legal, or you are prepared to reimplement the behavior in-house (it is small and well-understood).Config/Env facade, and have a removal date.Look elsewhere when:
vlucas/phpdotenv (v4/v5) or symfony/dotenv directly. They are actively maintained, permissively licensed, and have real dependent counts.env(): typed config objects, schema validation, secret backends (Vault, AWS Secrets Manager), or multi-environment precedence rules—none of which this provides.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.
How can I help you explore Laravel packages today?