Skip to content

Commit cb51d22

Browse files
committed
Update User Guide
1 parent b981b28 commit cb51d22

1 file changed

Lines changed: 33 additions & 14 deletions

File tree

guide/index.rst

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Config Manipulation
3535
$config = new Config();
3636
3737
The structure of a service instance configuration
38-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38+
#################################################
3939

4040
.. code-block:: php
4141
@@ -73,9 +73,10 @@ configuration file in the `App Project <https://docs.aplus-framework.com/guides/
7373
]
7474
7575
Set and Get
76-
^^^^^^^^^^^
76+
###########
7777

78-
**Set Service Configs**
78+
Set Service Configs
79+
^^^^^^^^^^^^^^^^^^^
7980

8081
.. code-block:: php
8182
@@ -86,7 +87,8 @@ Set and Get
8687
];
8788
$config->set($serviceName, $serviceConfigs);
8889
89-
**Get Service Configs**
90+
Get Service Configs
91+
^^^^^^^^^^^^^^^^^^^
9092

9193
.. code-block:: php
9294
@@ -99,7 +101,8 @@ Set and Get
99101
'username' => 'root',
100102
]
101103
102-
**Custom Service Instance Names**
104+
Custom Service Instance Names
105+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
103106

104107
.. code-block:: php
105108
@@ -112,7 +115,7 @@ Set and Get
112115
$configs = $config->get($serviceName, $serviceInstanceName);
113116
114117
Add
115-
^^^
118+
###
116119

117120
.. code-block:: php
118121
@@ -123,7 +126,7 @@ Add
123126
$config->add($serviceName, $serviceConfigs, 'custom');
124127
125128
Set Many
126-
^^^^^^^^
129+
########
127130

128131
.. code-block:: php
129132
@@ -147,7 +150,7 @@ Set Many
147150
]);
148151
149152
Get All
150-
^^^^^^^
153+
#######
151154

152155
.. code-block:: php
153156
@@ -181,6 +184,22 @@ key set:
181184
Persistence
182185
-----------
183186

187+
In the second argument of the Config class it is possible to set persistent
188+
configurations, which will not be overwritten by the ``add``, ``load``, ``set``
189+
and ``setMany`` methods:
190+
191+
.. code-block:: php
192+
193+
use Framework\Config\Config;
194+
195+
$directory = __DIR__ . '/../configs';
196+
$persistence = [
197+
'database' => [
198+
'host' => 'localhost',
199+
]
200+
]
201+
$config = new Config($directory, $persistence);
202+
184203
Parsers
185204
-------
186205

@@ -221,7 +240,7 @@ The Config Library provides the following parsers:
221240
- `Env Parser`_
222241

223242
INI Parser
224-
^^^^^^^^^^
243+
##########
225244

226245
INI syntax
227246

@@ -245,7 +264,7 @@ INI syntax
245264
custom.array.1 = 'False'
246265
247266
YAML Parser
248-
^^^^^^^^^^^
267+
###########
249268

250269
YAML syntax
251270

@@ -272,7 +291,7 @@ YAML syntax
272291
array: ['False']
273292
274293
Database Parser
275-
^^^^^^^^^^^^^^^
294+
###############
276295

277296
Database table
278297

@@ -335,7 +354,7 @@ Database table
335354
])->run();
336355
337356
JSON Parser
338-
^^^^^^^^^^^
357+
###########
339358

340359
JSON syntax
341360

@@ -370,7 +389,7 @@ JSON syntax
370389
}
371390
372391
XML Parser
373-
^^^^^^^^^^
392+
##########
374393

375394
XML syntax
376395

@@ -405,7 +424,7 @@ XML syntax
405424
</config>
406425
407426
Env Parser
408-
^^^^^^^^^^
427+
##########
409428

410429
Dotenv syntax
411430

0 commit comments

Comments
 (0)