chiqui3d/php-directives-bundle
date.timezone, locale settings) at runtime via Symfony’s configuration system. This is a niche use case—primarily useful for projects requiring runtime PHP directive overrides without server restarts (e.g., multi-tenant apps with locale/timezone isolation).php_directives.yaml, adding complexity to deployment pipelines (e.g., GitOps, CI/CD).ini_set() hacks, introducing edge cases.ini_set() calls can expose apps to misconfigurations (e.g., memory_limit, open_basedir). Lack of input validation in the bundle could lead to runtime errors or exploits.dl() calls (on some systems), adding latency.Why Runtime Directives?
php.ini/docker-entrypoint.sh?.env)?Symfony Dependency
vlucas/phpdotenv for .env overrides)?Failure Modes
date.timezone: Invalid/Zone) be handled?ini_set() fails (e.g., in safe_mode or containerized environments)?Alternatives
ParameterBag + Runtime component?Runtime bundle for dynamic configs)?Maintenance Plan
composer.json autoloading for Laravel)..env system (prefers environment variables over YAML configs).vlucas/phpdotenv + custom service provider to load .env directives.Config facade with bootstrapped values (e.g., config(['app.timezone' => env('APP_TIMEZONE')])).Dockerfile/docker-entrypoint.sh to set ini_set() at container startup.date.timezone, memory_limit)..env, php.ini) suffice.chiqui3d/php-directives-bundle to composer.json.php_directives.yaml with defaults.AppServiceProvider booting ini_set()).// app/Providers/AppServiceProvider.php
public function boot() {
ini_set('date.timezone', config('app.timezone'));
setlocale(LC_MONETARY, config('app.locale'));
}
composer.json.setlocale()—won’t affect system-wide locale settings (e.g., LC_ALL).open_basedir or disable_functions may require root privileges and could break if misconfigured.pcntl or sigterm handling for reloads.php_directives.yaml with minimal viable directives.date_default_timezone_get() returns expected value).ini_set() warnings/errors in logs.ini_set() becomes a vulnerability).memory_limit 128M here but 256M there?").ini_set() calls or alternative solutions.ini_set() calls add ~1–10ms per request (varies by directive).ini_set() are process-local. In PHP-FPM, changes won’t persist across workers without reloads (sigterm/sigusr1).pcntl_signal() to handle reloads or accept that directives are ephemeral.date.timezone) scale fine.session.save_path) may require shared storage or per-worker configs.| Failure Scenario | Impact | Mitigation |
|---|---|---|
Invalid directive (e.g., timezone) |
PHP warning/error, directive ignored. | Validate directives in config phase (e.g., Symfony’s Validator component). |
ini_set() permission denied |
Directive fails silently or throws PHP Fatal Error. |
Use ini_get() checks + fallback defaults. |
| Multi-process inconsistency | PHP-FPM workers have stale directive values. | Implement sigusr1 reloads or use environment variables instead. |
| Package abandonment | Bundle breaks with Symfony updates. | Fork the repo or migrate to a maintained alternative. |
| Security misconfiguration | open_basedir or disable_functions set incorrectly. |
Restrict configurable directives to a whitelist (e.g., only date.timezone). |
ini system and Symfony’s bundle lifecycle.composer.json and bundles.php.php_directives.yaml with defaults.How can I help you explore Laravel packages today?