cognesy / instructor-config
Lean config loading utilities for Instructor
v2.10.1
2026-09-13 07:12 UTC
Requires
- php: ^8.3
- symfony/config: ^7.0 || ^8.0
- symfony/yaml: ^7.0 || ^8.0
- vlucas/phpdotenv: ^5.6.1
Requires (Dev)
- pestphp/pest: ^4.0
- phpstan/phpstan: ^1.11
- vimeo/psalm: ^6.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v2.10.1
- v2.10.0
- v2.9.5
- v2.9.4
- v2.9.3
- v2.9.2
- v2.9.1
- v2.9.0
- v2.8.5
- v2.8.4
- v2.8.3
- v2.8.2
- v2.8.1
- v2.8.0
- v2.7.1
- v2.7.0
- v2.6.2
- v2.6.1
- v2.6.0
- v2.5.2
- v2.5.1
- v2.5.0
- v2.4.1
- v2.3.1
- v2.3.0
- v2.2.0
- v2.1.0
- v2.0.0
- v1.22.0
- v1.21.0
- v1.20.0
- v1.19.0
- v1.18.4
- v1.18.3
- v1.18.2
- v1.18.1
- v1.18.0
- v1.17.0
- v1.16.0
- v1.15.0
- v1.14.0
- v1.13.0
- v1.12.0
- v1.11.0
- v1.10.3
- v1.10.2
- v1.10.1
- v1.10.0
- v1.9.1
- v1.9.0
- v1.8.1
- v1.8.0
- v1.7.0
- v1.6.0
- v1.5.0
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.0
- v1.2.0
- v1.1.0
- v1.0.1-RC13
- v1.0.0
- v1.0.0-RC22
- v1.0.0-RC21
- v1.0.0-RC20
- v1.0.0-RC19
- v1.0.0-RC18
- v1.0.0-RC17
- v1.0.0-RC16
- v1.0.0-RC15
- v1.0.0-RC14
- v1.0.0-RC13
- v1.0.0-RC12
- v1.0.0-RC11
- v1.0.0-RC10
- v1.0.0-RC9
- 1.0.0-RC8
- 1.0.0-RC7
- 1.0-rc4
- 1.0-rc3
This package is auto-updated.
Last update: 2026-09-13 07:36:55 UTC
README
Minimal configuration infrastructure for Instructor.
Scope:
- load YAML or PHP config files as raw arrays,
- resolve relative config file names against multiple base paths,
- derive deterministic dot-keys from file paths,
- optional YAML/PHP parse cache compiled to PHP,
- parse DSN strings into raw arrays,
- accept application-owned secret resolvers for
${VARIABLE}interpolation, - no presets, provider-specific chains, secret persistence, or global settings.
Usage:
use Cognesy\Config\Config; use Cognesy\Config\ConfigLoader; $single = Config::fromPaths( __DIR__ . '/packages/polyglot/resources/config', __DIR__ . '/packages/http-client/resources/config', )->load('llm/presets/openai.yaml')->toArray(); $configs = ConfigLoader::fromPaths( __DIR__ . '/packages/polyglot/resources/config', __DIR__ . '/packages/http-client/resources/config', )->withCache(__DIR__ . '/var/cache/instructor-config.php'); $one = $configs->load('llm/presets/openai.yaml')->toArray(); $many = $configs->loadAll( 'llm/presets/openai.yaml', 'http/profiles/curl.yaml', );
Layered secret resolution is explicit and deterministic. The first source that
contains a value wins; provenance is safe to inspect, while the value remains
private and is never returned by ResolvedSecret::toArray():
use Cognesy\Config\Config; use Cognesy\Config\EnvTemplate; use Cognesy\Config\Secrets\DotenvFileSecretSource; use Cognesy\Config\Secrets\EnvironmentSecretSource; use Cognesy\Config\Secrets\SecretResolver; $secrets = new SecretResolver( new EnvironmentSecretSource('process-environment'), DotenvFileSecretSource::optional(__DIR__.'/.env', 'workspace-env'), DotenvFileSecretSource::optional('/app/private/credentials.env', 'app-credentials'), ); $entry = Config::fromPaths(__DIR__.'/config') ->withTemplate(new EnvTemplate($secrets)) ->load('llm.yaml'); $source = $secrets->resolve('OPENAI_API_KEY')?->source;
Applications own source ordering and persistence policy. Config resolves values
without mutating global Env state; it deliberately does not write secrets.
DSN parsing:
use Cognesy\Config\Dsn; $raw = Dsn::fromString('driver=openai,metadata.region=us-east-1')->toArray();