# Helpers

Autoloaded global helper functions available throughout the application. Registered via Composer's `autoload.files` in `composer.json`. `composer dump-autoload` must be run after modifying `CommonHelper.php` to ensure changes are available.

## Files

### `CommonHelper.php`

| Function | Description |
|----------|-------------|
| `safe_env($key, $default)` | Retrieves an environment variable; logs an error and sends an alert email if the key is missing (deduplicated per request) |
| `getActiveDayEnv($iProgramID, $default)` | Returns the active-day ID for a program by checking a config array first, then falling back to `safe_env()` |
| `getNicotineTypeLabel($setNicotineTypes, $tense, $isUserPlan)` | Returns the appropriate verb label (past/present/gerund) based on nicotine type (Cigarettes, Vaping, Sheesha, Smokeless) |
