PHP code example of snapshotpl / zf-snap-var-config
1. Go to this page and download the library: Download snapshotpl/zf-snap-var-config library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
snapshotpl / zf-snap-var-config example snippets
$myIp = '127.0.0.1';
return [
'db' => $myIp,
'memcache' => $myIp,
];
$data = [
'ips' => [
'local' => '127.0.0.1',
'memcache' => '127.0.0.2',
'smtp' => '127.0.0.3'
],
'email' => new ZfSnapVarConfig\Value\Env('ADMIN_EMAIL'),
'db' => ZfSnapVarConfig\Value\Path::fromString('ips/local'),
'memcache' => ZfSnapVarConfig\Value\Path::fromString('ips|memcache', '|'),
'email' => [
'smtp' => ZfSnapVarConfig\Value\Path::fromArray(['ips', 'smtp']),
'default-mail' => ZfSnapVarConfig\Value\Path::fromString('email'),
'reply-to' => ZfSnapVarConfig\Value\Path::fromString('email'),
'other-address' => new ZfSnapVarConfig\Value\Path('ips', 'smtp'),
],
];
$service = new ZfSnapVarConfig\VarConfigService();
$replaced = $service->replace($data); // or $service($data);
assertSame([
'ips' => [
'local' => '127.0.0.1',
'memcache' => '127.0.0.2',
'smtp' => '127.0.0.3'
],
'email' => '[email protected] ',
'db' => '127.0.0.1',
'memcache' => '127.0.0.2',
'email' => [
'smtp' => '127.0.0.3',
'default-mail' => '[email protected] ',
'reply-to' => '[email protected] ',
'other-address' => '127.0.0.3',
],
], $replaced);