Dutch PHP Conference 2027

Налаштування під час виконання

На поведінку цих функцій випливають налаштування в php.ini.

Yaconf Параметри конфігурації
Назва Початково Де можна змінювати Журнал змін
yaconf.directory "" INI_SYSTEM  
yaconf.check_delay 300 INI_SYSTEM  

Тут є коротке пояснення директив конфігурації.

yaconf.directory string

The directory where all INI configuration files are placed. Only files with the .ini extension are loaded. Sub-directories are loaded recursively (up to 16 levels deep); each one acts as a key level, so a file database.ini placed in the users/ sub-directory is addressed as "users.database". Available since Yaconf 1.2.0; before that only files directly in the directory were loaded.

The examples below assume the following database.ini placed in the configured directory, alongside a features.ini that carries per-feature settings.

Приклад #1 INI file syntax

; database.ini
name=production                        ; scalar value
version=PHP_VERSION                    ; PHP constants are resolved
connection_string=${DATABASE_URL}      ; environment variables are resolved
options.max_connections=50             ; nested hash key
options.timeout=30

; array entries, both notations are equivalent
replicas.0=replica-1.example.com
replicas[]=replica-2.example.com

Приклад #2 INI sections example

; features.ini
[default]
cache_enabled=on
rate_limit=100

; the "premium" section inherits every key from "default" and
; overrides the ones it redefines
[premium:default]
rate_limit=1000
yaconf.check_delay int

The interval, in seconds, at which Yaconf checks whether any loaded INI file has changed and reloads the changed ones (the change is detected by comparing directory modification times). Setting it to 0 makes Yaconf check on every request.

Зауваження:

This directive is only registered in non-ZTS builds. On ZTS (thread-safe) builds configurations are loaded at startup and automatic reloading is not available; restart PHP to pick up changes.

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top