Download the PHP package clippings/env-backup without Composer
On this page you can find all versions of the php package clippings/env-backup. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download clippings/env-backup
More information about clippings/env-backup
Files in clippings/env-backup
Package env-backup
Short Description Backup/restore environment variables: globals, static vars, configs
License BSD-3-Clause
Informations about the package env-backup
Env Backup
Backup/restore environment variables: globals and static vars. This is very useful for initializing environment for a test. Keep the current state of the environment from interfering with other tests.
You can add "Parameters" to the environment, each "applying" and "restoring" a specific super global or static property of a class, you can even keep a precice state of the filesystem.
GlobalParam
- used for setting / restoring '_POST', '_GET', '_FILES', '_SERVER', '_COOKIE' and '_SESSION'ServerParam
- used specifically for '_SERVER' super global so you can set / restore only some of its contents, e.g. REMOTE_HOST', 'CLIENT_IP ...StaticParam
- used for setting / restoring static properties of classes, it can handle protected and private ones too.FileParam
- used for setting / restoring files and their contents. Ensures a certain file and its content are present, and restore previous stateDirectoryParam
- used for setting / restoring a whole dir with all of its contents. Ensures a certain dir and its content are present, and restore previous state
Example:
ServerParam in CLI
In CLI environment, $_SERVER variables are very different than if the script is run by apache or cgi. If you want to use env-backup in such an environment, you can pass ServerParam::CLI like this:
License
Copyright (c) 2014, Clippings Ltd. Developed by Ivan Kerin as part of clippings.com
Under BSD-3-Clause license, read LICENSE file.