爱因斯坦/环境学家

通过管理包含路径、错误处理和自动加载来清理你的环境

0.0.1 2013-06-27 00:44 UTC

This package is not auto-updated.

Last update: 2024-09-23 15:15:37 UTC


README

通过管理包含路径、错误处理和自动加载来清理你的PHP环境

安装

如果你使用composer,只需将einstein/environmentalist依赖项添加到你的composer.json文件中。

否则,你可以通过克隆存储库到你的php include_path中的某个位置来手动安装它。

git clone git@github.com:einstein/environmentalist.git`
require 'environmentalist/environmentalist.php';

使用方法

启用/禁用

Environmentalist::enable()在加载时被调用。如果你想禁用其行为,只需调用Environmentalist::disable()

自动加载扩展

Environmentalist::autoload_extensions()
Environmentalist::append_autoload_extension($extension)
Environmentalist::prepend_autoload_extension($extension)
Environmentalist::set_autoload_extensions($extensions)

错误处理

Environmentalist::error_handlers()
Environmentalist::append_error_handler($handler)
Environmentalist::prepend_error_handler($handler)
Environmentalist::set_error_handlers($handlers)

包含路径

Environmentalist::include_paths()
Environmentalist::append_include_path($path)
Environmentalist::prepend_include_path($path)
Environmentalist::set_include_paths($paths)

测试

Environmentalist测试需要jaz303/ztest

简单地将它下载到environmentalist/test/ztest(或你的PHP include_path中的任何其他位置),然后运行test/run

待办事项

  • 更新README文档
  • 允许注册其他文件名命名约定
  • 统一set_*方法的返回值
  • 更新测试