youwe/composer-file-installer

使用Composer安装文件。

1.2.2 2023-06-15 10:18 UTC

This package is auto-updated.

Last update: 2024-09-15 12:57:13 UTC


README

将文件作为项目的一部分安装,作为 composer installcomposer update 的部分。使用 youwe/file-mapping 包根据源 -> 目标映射移动文件。Composer 的 IOInterface 为文件安装器提供写入文件和向最终用户提供输出消息的能力。

使用示例

<?php
// Create a file mapping.
$mappingFilePaths = new UnixFileMapping(
     __DIR__ . '/../folder/files',
     getcwd(),
     ['./dir/one','./dir/two']

 );

// Get a file mapping reader.
$reader = new UnixFileMappingReader($sourceDirectory, $targetDirectory, $mappingFilePaths);

// Get an installer, supply with the file mapping reader.
$installer = new FileInstaller($reader);

// Install according to mapping, supply with Composer IOInterface.
$installer->install($io);