dcg/dcg-membership-number-config 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

dcg/dcg-membership-number-config

Composer 安装命令:

composer require dcg/dcg-membership-number-config

包简介

A package to add config to a project

README 文档

README

A package to add config to a project

Usage

To add this library to an existing application,

Add the following repository to the app's composer.json,

"repositories": [
    {
        "type": "vcs",
        "url": "https://git@bitbucket.org/tastecard/dcg-lib-config.git"
    }
]

Add the following to the require section,

"dcg/dcg-lib-config": "dev-master"

Add this to the scripts section:

"scripts": {
    "post-update-cmd": [
        "Dcg\\Config\\FileCreator::createConfigFile",        
    ]
}

OR, if the parent project is to be a dependancy of another project which also needs config. Create a class which extends FileCreator and specify a different source/destination config file like so:

namespace Dcg\Client\MembershipNumberState\Config;

class FileCreator extends \Dcg\Config\FileCreator
{
    /**
     * Get the location of the config file to use as an example (template)
     * @param Composer\Script\Event $event
     * @return string
     */
    protected static function getSourceFile(\Composer\Script\Event $event) {
        $vendorDir = $event->getComposer()->getConfig()->get('vendor-dir');
        return $vendorDir . DIRECTORY_SEPARATOR . 'dcg' . DIRECTORY_SEPARATOR . 'dcg-lib-membership-number-state-client' . DIRECTORY_SEPARATOR . 'config.php';
    }

    /**
     * Get the location of where the config file should be copied to
     * @param Composer\Script\Event $event
     * @return string
     */
    protected static function getDestinationFile(\Composer\Script\Event $event) {
        $vendorDir = $event->getComposer()->getConfig()->get('vendor-dir');
        return dirname($vendorDir) . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'membership-number-state-config.php';
    }
    
}

Create the config class which uses the config file specific to the project which needs config

namespace Dcg\Client\MembershipNumberState;

class Config extends \Dcg\Config {

    /**
     * Get the default config file to use
     * @return string
     */
    protected static function getDefaultConfigFile() {
        return self::getRootDir().'/config/membership-number-state-config.php';
    }
}
  • Run composer install

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2019-06-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固