定制 cpsit/setup-helper 二次开发

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

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

cpsit/setup-helper

Composer 安装命令:

composer require cpsit/setup-helper

包简介

Helps setting up a project bundle. This is a composer plugin. It performs predefined tasks on composer after update or install command.

README 文档

README

Build Status Quality Gate Status

Setup Helper

Helps setting up project bundles based on configuration and templates.

This is a composer plugin. It performs predefined tasks on composer after update or install command.

Usage

composer require cpsit/setup-helper

Configuration

Add a key setup-helper to to the extra section of your composer.json. Note: Paths must be relative to your composer root directory or absolute.

Copy files or folder

{
  "extra": {
    "setup-helper": [
      {
        "copy": {
          "path/to/file/or/folder": "path/to/target",
          "other/file": "other/target"
        }
      }
    ]
  }
}

Unlink files or folders

{
  "extra": {
    "setup-helper": [
      {
        "unlink": [
          "path/to/file/or/folder",
          "other file"
        ]
      }
    ]
  }
}
  • there is no confirmation request. Any existing file or folder will be removed!

Move files or folders

{
  "extra": {
    "setup-helper": [
      {
        "move": {
          "path/to/old/file/or/folder": "path/to/new/folder",
          "other/file": "new/path"
        }
      }
    ]
  }
}

Note: Move does not rename a file or folder. If required combine it with a Rename task.

Rename files or folders

{
  "extra": {
    "setup-helper": [
      {
        "rename": {
          "path/to/old/file/or/folder": "newName",
          "other/file": "otherName"
        }
      }
    ]
  }
}

The source path is relative to the current working directory. This should always be the composer root directory, if the Installer is called via composer plugin API as expected.

Make directory

{
  "extra": {
    "setup-helper": [
      {
        "makeDirectory": [
          "path/to/new/folder"
        ]
      }
    ]
  }
}

The directory path is relative to the current working directory. This should always be the composer root directory, if the Installer is called via composer plugin API as expected. Any missing directory will be created recursively.

Symlink from source to target

{
  "extra": {
    "setup-helper": [
      {
        "symlink": {
          "path/to/source/file": "target",
          "file": "even/deeper/path/to/target"
        }
      }
    ]
  }
}

The source path is relative to the current working directory. This should always be the composer root directory, if the Installer is called via composer plugin API as expected. On existing source or target no symlink is created.

Replace

  • Replace a string with another string:
{
  "extra": {
    "setup-helper": [
      {
        "replace": [
          {
            "path": "path/to/file",
            "search": "string-to-replace", 
            "replace": "replacement string"
           }           
        ]
      }
    ]
  }
}
  • Replace a string with a string given as answer to a question (interactively)
{
  "extra": {
    "setup-helper": [
      {
        "replace": [
           {
             "path": "path/to/file",
             "search": "string-or-pattern-to-replace", 
             "ask": "Question to ask for (Answer replaces pattern)"
           }           
        ]
      }
    ]
  }
}

The path key respects Ant-like globbing.

Syntax:

  • ? matches any character
  • * matches zero or more characters, except /
  • /**/ matches zero or more directory names
  • [abc] matches a single character a, b or c
  • [a-c] matches a single character a, b or c
  • [^abc] matches any character but a, b or c
  • [^a-c] matches any character but a, b or c
  • {ab,cd} matches ab or cd

E.g. "path": /path/to/dir/*.css will select all files ending in .css in that directory.

See documentation of glob library for details.

Caveats

Currently we rely on a the fork cpsit/glob of webmozart/glob since the original doesn't allow recent PHP versions.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2019-02-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固