定制 idct/composer-custom-directory 二次开发

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

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

idct/composer-custom-directory

Composer 安装命令:

composer require idct/composer-custom-directory

包简介

A composer plugin, to install differenty types of composer packages in custom directories outside the default composer default installation path which is in the `vendor` folder.

README 文档

README

A composer plugin, to install differenty types of composer packages in custom directories outside the default composer default installation path which is in the vendor folder.

Based & heavily influenced by repository by mnsami: https://github.com/mnsami/composer-custom-directory-installer (Moved outside of a fork due to slow or no maintenance by the original author.)

Installation

  • Include the composer plugin into your composer.json require section - for example:
  "require":{
    "php": ">=5.4",
    "idct/composer-directory-installer": "1.0.*",
    "monolog/monolog": "*"
  }
  • In the extra section define the custom directory you want to the package to be installed in::
  "extra":{
    "installer-paths":{
      "./monolog/": ["monolog/monolog"]
    }

by adding the installer-paths part, you are telling composer to install the monolog package inside the monolog folder in your root directory.

Dynamic paths

Feature which allows you to install packages in different directories depending on a set of predefined tokens.

  • For example, a setting:
    "extra": {
        "installer-paths": {
            "./packages/{$name}": ["sourcepackage/package_A","sourcepackage/package_B","sourcepackage/package_B"]
        }
    },

will install packages provided in the list (sourcepackage/package_A, sourcepackage/package_B, sourcepackage/package_C) in folders:

  • ./packages/package_A
  • ./packages/package_B
  • ./packages/package_C

defined tokens are:

  • $name which will return the second part of the package name, after /. For example for sourcepackage/package_A it will be package_A. In case of missing parts will return undefined.
  • $package - returns full package name.
  • $vendor - same as $name but works with the first part of the package name.

Flags

Dynamic path definitions support flags for manipulation of the target name. Flags are parsed in a chain from the left to the right therefore the order of them is important

Currently supprted flags are:

  • F - capitalizes first letter.
  • P - changes all entries of a _ or - followed by a character to only that character, capitalized.

Usage:

Flags should be entered after the flag variable followed by a pipe |.

For example:

    "extra": {
        "installer-paths": {
            "./packages/{$name|FP}": ["sourcepackage/my_package1","sourcepackage/my_package2","sourcepackage/my_package3"]
        }
    },

will install the packages into folders:

  • ./packages/MyPackage1
  • ./packages/MyPackage2
  • ./packages/MyPackage3

As the flag F will make the first letter a capital letter and the flag P will remove all _ (or -) and capitalize the following letter.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-12-22