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() helper to non-Laravel PHP code. It fits legacy PHP services, CLI scripts, and transitional apps that need Laravel-style .env access but are not on Laravel. It does not fit Laravel 5.8+ apps, modern config-management needs, or systems requiring a supported configuration abstraction. As a TPM, treat it as a tactical adapter in a migration path, not a strategic platform dependency.env() function. Integration is straightforward for a single non-Laravel service but should be gated by a compatibility spike.NOASSERTION, which is a release blocker until legal review confirms terms. Global function definition can collide with existing helpers. Maintenance is likely stale, with no vendor SLA. Security risk around .env loading/parsing and secret handling must be validated..env, or only define the helper? Which vlucas/phpdotenv version and parsing semantics are used? Does it cache values, and how are nulls/defaults handled? Is the license actually MIT/BSD or unlicensed? Does it guard against redeclaring env()? Can we vendor/fork it safely? Does it conflict with framework or test bootstrap helpers?.env files and want Laravel-like env('KEY', 'default') calls. Poor fit for Laravel apps (native helper exists), modern PHP frameworks with their own config, or services needing typed/config-cached configuration.env() after upgrading to Laravel 5.8+, or replace with an internal config object/getenv() wrapper. If legal review fails, copy the minimal helper logic into an internal package rather than depending on upstream. Plan an exit from day one.env() exists and reads a known key/default. Confirm behavior in PHPUnit, queue workers, CLI, and web SAPIs. Do not assume PHP 8 compatibility without evidence.env()/getenv() usage and define precedence rules. (4) Roll out behind a feature-flagged bootstrap or internal wrapper. (5) Document supported keys and defaults. (6) Schedule replacement with native Laravel or internal config. Avoid broad rollout until license and PHP support are cleared..env mutation. Confirm opcache and worker restart behavior when env values change.env(); redeclaration conflicts with other polyfills/frameworks; malformed .env values parse differently than expected; secrets can leak if .env is web-accessible or committed; stale values in long-running workers; PHP version incompatibility; unlicensed use creates legal exposure. Mitigate with smoke tests, .env hygiene, secret scanning, pinned dependencies, and a documented fallback.env() helper; moderate for teams needing to understand dotenv semantics and global-function conflicts. Provide a short internal guide: supported PHP versions, bootstrap requirement, default-value conventions, .env security rules, and the planned replacement path.How can I help you explore Laravel packages today?