定制 openbuildings/environment-backup 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

openbuildings/environment-backup

最新稳定版本:0.1.2

Composer 安装命令:

composer require openbuildings/environment-backup

包简介

Backup/restore environment variables: globals, static vars, configs

README 文档

README

Set environment variables: globals, static vars, kohana configs etc. and later restore their original values. This is useful testing when you want to have a specific environment set for the test, but don't want that test to affect other code outside of it.

The environment class is initialized with some environment groups, each handling specific type of environment. You can easily add more classes to handle different environments.

Each environment group that you add allows has a unique name of "naming" its variables so that it knows how to handle their backup

  • '_POST', '_GET', '_FILES', '_SERVER', '_COOKIE' and '_SESSION' are handled by the 'Environment_Group_Globals',
  • 'REMOTE_HOST', 'CLIENT_IP' and all the other variables inside the '_SERVER' variable are handled by Environment_Group_Server (this is used to easily backup restore only sertain variables of the $_SERVER super global)
  • 'SomeClass::$variable' is used to handle stativ variables - it can backup / restore public, protected and private ones by Environment_Group_Static
  • 'group.config_var' is used to handle Kohana config settings by Environment_Group_Config - this is used only in a Kohana Framwork environment

Example:

$environment = new Environment(array(
	'globals' => new Environment_Group_Globals(),
	'server' => new Environment_Group_Server(),
	'static' => new Environment_Group_Static(),
));

$environment->backup_and_set(array(
	'_POST' => array('new stuff'),
	'REMOTE_HOST' => 'example.com',
	'MyClass::$private_var' => 10
));

// Do some stuff that changes / uses these variables

$environment->restore();

License

Copyright (c) 2012-2013, OpenBuildings Ltd. Developed by Ivan Kerin as part of clippings.com

Under BSD-3-Clause license, read LICENSE file.

统计信息

  • 总下载量: 136.45k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 2
  • 依赖项目数: 10
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 10
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2013-07-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固