定制 olegpopadko/composer-heroku-database-environment 二次开发

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

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

olegpopadko/composer-heroku-database-environment

Composer 安装命令:

composer require olegpopadko/composer-heroku-database-environment

包简介

Simple connect to herokupostgres for php-applications

README 文档

README

Simple connect to herokupostgres for php-applications

##Usage

Add the following in your root composer.json file:

{
    "require": {
        "olegpopadko/composer-heroku-database-environment": "dev-master"
    },
    "scripts": {
        "post-install-cmd": [
            "OlegPopadko\\HerokuDatabaseEnvironment\\Composer\\EnvironmentHandler::expand"
        ]
    }
}

EnvironmentHandler divides DATABASE_URL environment variable and expands your environment with new five variables.

After composer install you will have something like this in your environment

DATABASE_URL=postgres://user:password@database.host:5432/database_name

DATABASE_HOST=database.host
DATABASE_PORT=5432
DATABASE_USER=user
DATABASE_PASSWORD=password
DATABASE_NAME=database_name

Now you can easily setup your app with Heroku database credentials.

##Addition setup for incenteev/composer-parameter-handler

You can setup it in composer.json like this:

{
  "scripts": {
      "post-install-cmd": [
          "OlegPopadko\\HerokuDatabaseEnvironment\\Composer\\EnvironmentHandler::expand",
          "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters"
      ]
  },
  "extra": {
        "incenteev-parameters": {
            "file": "app/config/parameters.yml",
            "env-map": {
                "database_host": "DATABASE_HOST",
                "database_port": "DATABASE_PORT",
                "database_name": "DATABASE_NAME",
                "database_user": "DATABASE_USER",
                "database_password": "DATABASE_PASSWORD"
            }
        }
    }
}

Note: EnvironmentHandler::expand must be executed before ScriptHandler::buildParameters.

It's would be usefull if you are using Symfony.

统计信息

  • 总下载量: 33
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-10-10