PHP code example of clippings / env-backup

1. Go to this page and download the library: Download clippings/env-backup 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/ */

    

clippings / env-backup example snippets


use CL\EnvBackup\Env;
use CL\EnvBackup\GlobalParam;
use CL\EnvBackup\ServerParam;
use CL\EnvBackup\StaticParam;

$env = new Env(array(
    new GlobalParam('_POST', array('new post name' => 'val')),
    new ServerParam('REMOTE_ADDR', '1.1.1.1'),
    new StaticParam('MyClass', 'private_var', 10)
    new FileParam('/path/to/file', 'file content')
    new DirectoryParam('/path/to/dir', array(
        'file1.txt' => 'file contents',
        'inner_dir' => array(
            'inner_file1.csv' => 'a, b',
            'inner_file2.txt' => 'test',
        )
    ))
));

$env->apply();

// Do some stuff that changes / uses these variables
// ...

$env->restore();

$env = new Env(array(
    new ServerParam('HOME', '/test/home', ServerParam::CLI),
    new ServerParam('argc', 4, ServerParam::CLI),
));