77
88- ``Infocyph\ArrayKit\Config\Config ``
99- ``Infocyph\ArrayKit\Config\LazyFileConfig ``
10- - ``Infocyph\ArrayKit\Config\DynamicConfig ``
1110
12- ``DynamicConfig `` extends ``Config `` by adding value hooks.
11+ ``Config `` supports optional hooks via explicit ``getWithHooks() ``,
12+ ``setWithHooks() ``, and ``fillWithHooks() `` methods.
1313``LazyFileConfig `` loads namespace files only on first keyed access.
1414
1515Loading Configuration
@@ -129,23 +129,24 @@ Array-Value Helpers
129129 // ['cors', 'auth', 'throttle']
130130 $middleware = $config->get('middleware');
131131
132- DynamicConfig Hooks
133- -------------------
132+ Config Hooks (Explicit)
133+ -----------------------
134134
135- ``DynamicConfig `` allows per-key transformation on read/write.
135+ ``Config `` allows per-key transformation on read/write, while keeping
136+ ``get()/set()/fill() `` hook-free for maximum base-path performance.
136137
137138.. code-block :: php
138139
139140 <?php
140- use Infocyph\ArrayKit\Config\DynamicConfig ;
141+ use Infocyph\ArrayKit\Config\Config ;
141142
142- $config = new DynamicConfig ();
143+ $config = new Config ();
143144
144145 $config->onSet('user.name', fn ($v) => strtoupper((string) $v));
145146 $config->onGet('user.name', fn ($v) => strtolower((string) $v));
146147
147- $config->set ('user.name', 'Alice');
148- echo $config->get ('user.name'); // alice
148+ $config->setWithHooks ('user.name', 'Alice');
149+ echo $config->getWithHooks ('user.name'); // alice
149150
150151 Bulk operations with hooks:
151152
@@ -154,12 +155,12 @@ Bulk operations with hooks:
154155 <?php
155156 $config->onSet('user.email', fn ($v) => trim((string) $v));
156157
157- $config->set ([
158+ $config->setWithHooks ([
158159 'user.name' => 'JOHN',
159160 'user.email' => ' [email protected] ', 160161 ]);
161162
162- $vals = $config->get (['user.name', 'user.email']);
163+ $vals = $config->getWithHooks (['user.name', 'user.email']);
163164
164165 Practical Pattern
165166-----------------
@@ -169,15 +170,15 @@ Use config as a mutable runtime container for app setup:
169170.. code-block :: php
170171
171172 <?php
172- $config = new DynamicConfig ();
173+ $config = new Config ();
173174 $config->loadFile(__DIR__.'/config.php');
174175
175176 // Normalize selected runtime values
176177 $config->onSet('app.timezone', fn ($v) => trim((string) $v));
177178 $config->onGet('app.timezone', fn ($v) => strtoupper((string) $v));
178179
179- $config->set ('app.timezone', ' utc ');
180- $tz = $config->get ('app.timezone'); // UTC
180+ $config->setWithHooks ('app.timezone', ' utc ');
181+ $tz = $config->getWithHooks ('app.timezone'); // UTC
181182
182183 LazyFileConfig
183184--------------
@@ -231,9 +232,9 @@ LazyFileConfig methods:
231232- ``preload() ``, ``isLoaded() ``, ``loadedNamespaces() ``
232233- ``all() `` (throws by design)
233234
234- DynamicConfig methods:
235+ Hook-aware methods (Config and LazyFileConfig) :
235236
236- - ``get () `` (hook-aware override)
237- - ``set () `` (hook-aware override)
238- - ``fill () `` (hook-aware override)
237+ - ``getWithHooks () ``
238+ - ``setWithHooks () ``
239+ - ``fillWithHooks () ``
239240- ``onGet() ``, ``onSet() ``
0 commit comments