markocupic/composer-file-copier-plugin 问题修复 & 功能扩展

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

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

markocupic/composer-file-copier-plugin

Composer 安装命令:

composer require markocupic/composer-file-copier-plugin

包简介

Copy files or mirroring folders from a package dist directory to the filesystem during 'composer-install-cmd' or 'composer-update-cmd'.

README 文档

README

Logo

Composer File Copier Plugin

Let's assume you have developed a composer package. Now you want selected files inside your package to be copied to a defined location on your local file system after each post-install-cmd and post-update-cmd event. With a bit of configuration this composer plugin can do this job for you.

The configuration is made inside the extra key of the composer.json file of your freshly programmed composer package.

Installation

composer require markocupic/composer-file-copier-plugin

Build your composer package

<project_root>/
├── app/
├── public/
└── vendor/
    └── code4nix/
        └── super-package/
            ├── .github/
            ├── src/
            ├── tests/
            ├── data/
            │   ├── foo.txt
            │   ├── style.css
            │   ├── config.yaml
            │   └── test1/
            │       ├── foo1.txt
            │       ├── style1.css
            │       ├── config1.yaml
            │       └── test2/
            │           ├── foo2.txt
            │           ├── style2.css
            │           └── config2.yaml
            └── composer.json    # configuration goes here!

Big thanks to https://tree.nathanfriend.io for sharing this fancy tree generator. ❤️

Configuration

The configuration is made inside the extra key of the composer.json file inside your composer package.

Note, that source paths are always relative to the installation directory of your package.

Note, that target paths are always relative to the project root.

Inside the composer.json of your package:

{
    "name": "code4nix/super-package",
    "type": "symfony-bundle",
    "require": {
        "php": "^8.1",
        "markocupic/composer-file-copier-plugin": "^0.1"
    },
    "autoload": {
        "psr-4": {
            "code4nix\\SuperPackage\\": "src/"
        }
    },
    "extra": {
        "composer-file-copier-plugin": [
            {
                "source": "data/foo.txt",
                "target": "foo.txt"
            },
            {
                "source": "data/foo.txt",
                "target": "foo.txt",
                "options": {
                    "OVERRIDE": true
                }
            },
            {
                "source": "data/test1",
                "target": "files/test1",
                "options": {
                    "OVERRIDE": true,
                    "DELETE": true
                }
            },
            {
                "source": "data",
                "target": "files/data",
                "options": {
                    "OVERRIDE": true
                },
                "filter": {
                    "NAME": [
                        "*.css",
                        "*.yaml"
                    ],
                    "DEPTH": [
                        "> 1",
                        "< 3"
                    ]
                }
            }
        ]
    }
}

Mandatory keys Description
source Add a path to a file or directory. The path you set is relative to the package root.
target Add a path to a file or directory. If the source path points to a file, then the destination path should point to a file as well. The target path is always relative to the document root.

Options

Option Description Affects
OVERRIDE Accepted values: boolean true or false. Overwrite existing newer files in target directory. Default to false. files & folders
DELETE Accepted values: boolean true or false. Whether to delete files that are not in the source directory should be deleted. Default to false. This option is not available, when using filters. folders

Filters

Filter Description
NAME Accepted values: array "NAME": ["*.less","*.json"]. See Symfony Finder component.
NOT_NAME Accepted values: array "NOT_NAME": ["*.php","*.js"]. See Symfony Finder component.
DEPTH Accepted values: array "DEPTH": ["< 1","> 4"] See Symfony Finder component.

Additional configuration

By default this package will not process the following package types: library','metapackage','composer-plugin','project'.
This can be overridden in your composer.json by specifying which package to exclude:

{
    "extra": {
        "composer-file-copier-excluded": ["library", "metapackage", "composer-plugin"]
    }
}

⚠️ Last but not least!

Note, that this is a very powerful but also dangerous tool that can OVERRIDE/DELETE files/folders and DESTROY/DAMAGE your installation if wrongly applied.

markocupic/composer-file-copier-plugin 适用场景与选型建议

markocupic/composer-file-copier-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 19.62k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2023 年 07 月 19 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 markocupic/composer-file-copier-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 markocupic/composer-file-copier-plugin 我们能提供哪些服务?
定制开发 / 二次开发

基于 markocupic/composer-file-copier-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-07-19