定制 therat/branching 二次开发

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

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

therat/branching

最新稳定版本:2.7.0

Composer 安装命令:

composer require therat/branching

包简介

Symfony BranchingBundle. Auto change database depends on еру current git branch.

README 文档

README

Symfony BranchingBundle. Auto change mysql database depends on current git branch.

SensioLabsInsight

Bundle version is connected with supported symfony version.

Installation

Download bundle by composer

composer require therat/branching

Then, enable the bundle by adding the following line in the app/AppKernel.php file of your project:

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        if (in_array($this->getEnvironment(), ['dev', 'test'])) {
            $bundles[] = new TheRat\BranchingBundle\TheRatBranchingBundle();

        // ...
    }

    // ...
}

Create new branch git branch feature or git checkout -b feature.

After that run 'app/console' command, and bundle create and copy new database automatically.

Be sure, that your mysql connect has privileges to create new scheme. Bundle use default symfony connection params 'database_host' etc.

Configuration

# Default configuration for "BranchingBundle"

the_rat_branching:
    switch_db: false     #enable or disable auto switch db
    copy_db_data: false  #copy db from root db

Nginx example

Obviously, you're hosting must support dns name like this *.test.my.project.com. There is an example of nginx config for different branches:

server {
    #...
    
    if ($branch = "") {
        set $branch "master";
    }
    server_name ~^(www\.)?(?<branch>.+)\.test\.my\.project\.com$;
    root /www/test.my.project.com/project/$branch/web;
    
    #...

Twig extensions

Current branch

  • Get current branch, useful for generating project title
#your twig template file

{{ current_branch() }}

For master branch return master (dev) string.

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固