ministryofjustice/opg-core-health-check

此包已被废弃,不再维护。未建议替代包。

OPG Core Health Check ZF2 模块

1.0.1 2015-06-15 16:10 UTC

This package is not auto-updated.

Last update: 2020-01-17 21:03:27 UTC


README

此模块提供与检查其他 opg 核心应用程序健康状况相关的 zend 服务,具体包括 opg-core-back-endopg-core-front-endopg-core-auth-membrane

安装

  1. 通过 Composer 将此模块作为 zf2 项目的依赖项安装。如果您没有 composer,请按照他们的网站上的步骤下载: https://getcomposer.org.cn/download/
  2. 使用应用程序注册模块

您的 composer.json 应该看起来像这样

{
    "repositories": [
        {
            "type": "vcs",
            "url": "git@github.com:ministryofjustice/opg-core-health-check.git"
        }
    ],
    "require": {
        "ministryofjustice/opg-core-health-check": "1.0.*",
    }
}

您的 config/application.config.php 应该看起来像这样

$modules = array(
    ...
    'HealthCheck',
);

用法

示例控制器操作:使用环境变量检查服务,如果缺少任何内容,则返回错误 500 和 json 错误。

    public function checkEnvVarsAreSetAction()
    {
        try {
            $this->getServiceLocator()->get('EnvironmentVariablesChecker')->check();
        } catch (HttpException $e) {
            // Environment variable(s) missing:
            $this->getResponse()->setStatusCode($e->getStatusCode());

            return new JsonModel(array('error' => $e->getMessage()));
        }

        return $this->getResponse();
    }

测试

  1. 克隆它。
  2. 通过 composer 安装依赖项。如果您没有 composer,请按照他们的网站上的步骤下载: https://getcomposer.org.cn/download/
  3. 运行 PHPUnit。
git clone git@github.com:ministryofjustice/opg-core-health-check.git
cd opg-core-health-check.git
composer install
php ./vendor/bin/phpunit

贡献

  1. 克隆它。
  2. 创建您的功能分支: git checkout -b my-new-feature
  3. 提交您的更改: git commit -am 'Add some feature'
  4. 推送到分支: git push origin my-new-feature
  5. 提交 pull request :D

历史

2015-04-16: 将仓库重用为从原始空 zf2 框架应用程序转换的 zf2 模块

鸣谢