Configuration Methods



The default settings in the ZN Framework are in two different arrays. These;

Directory: Settings /
Directory: Projects / Any / Config /

directories are. You can use the settings in these directories or change the settings. Besides that, you can also configure your own settings.

Configuration Priority

If both files have the same name and settings, priority becomes important. The order of priority is;

Config /

Settings /

These settings are combined if there are the same named file and different settings in both knees. It is used as if you are withdrawing from a single file. If the same name settings are available, the priority is as shown above.

 

 

# Methods


Mixed get ( String $ file , String $ configs = NULL )
Mixed set ( String $ file , Mixed $ configs = NULL , Mixed $ settings = NULL )

 

 

# Get ( ZN >= 1.0.0 )


Used to access the settings from the setup files.

Parameters
String $ file File name.
String $ config = NULL The name of the setting.
return Mixed
Use
File:  Config / Project.php
output( Config::get('Project', 'log') );
CreateFile => boolean false (length = 5 ) ,
FileTime => string '30 day ' (length = 8 ) ,
$log = Config::get('Project', 'log');
echo $log['fileTime'];
30 day
Short Call ( 5.0.0 )

It is possible to call your settings shorter.

Rule: Config :: fileName ([String $ configName ])
output( Config::database() );
output( Config::project('key') );

 

 

# Set ( ZN >= 1.0.0 )


Used to change setting values. This change is not made on the file. Only values ​​coming to the get () method are manipulated.

Parameters

Parameters
String $ file File name.
Mixed $ config = NULL The name of the setting.
Mixed $ newConfig = NULL New settings.
return Mixed
Use
Config::set('Project', 'log', ['fileTime' => '60 day']);

output(Config::get('General', 'log'));
CreateFile => boolean false (length = 5 ) ,
FileTime => string '60 day ' (length = 8 ) ,
Short Configuration ( 5.0.0 )

It is possible to call your settings shorter.

Rule: Config :: fileName ([Mixed $ set ], [Mixed $ set ])
Config::project(['key' => 'example key']);

output( Config::project('key') );

You can also configure by using parameter 2 as follows.

Config::project('key', md5('my key'));

output( Config::project('key') );

 

 

# Create a Configuration File


You may want to create a setup file yourself. You can also use the 3 above mentioned for this . However, it is recommended that you do this for the Config / directory if you plan to cover a single project . For this you need to come up with this php directory and create a php file. You need to define the settings into the file that you create as the following example settings.

File:  Config / Example.php
return
[
    'example1' => 'Example Value 1',
    'example2' => 'Example Value 2'
];

After you have defined the above, you can call it as follows.

Use

output(Config::get('Example', 'example1'));
Example Value 1;

Or

echo Config::example('example1');