Skip to content

Commit 6cef236

Browse files
authored
Added usage example
1 parent 742a0b9 commit 6cef236

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

README.md

+22-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
11
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/mediact/composer-file-installer/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/mediact/composer-file-installer/?branch=master)
22

33
# composer-file-installer
4-
Install files in a project as part of a `composer install` or `composer update`.
4+
Install files in a project as part of a `composer install` or `composer update`. Uses the[mediact/file-mapping](https://github.com/mediact/file-mapping) package for moving files according to a source -> destination mapping. The Composer `IOInterface` supplies the file installer with the capabiliy to write the files and supply end-users with output messages.
5+
6+
# Usage example
7+
```php
8+
<?php
9+
// Create a file mapping.
10+
$mappingFilePaths = new UnixFileMapping(
11+
__DIR__ . '/../folder/files',
12+
getcwd(),
13+
['./dir/one','./dir/two']
14+
15+
);
16+
17+
// Get a file mapping reader.
18+
$reader = new UnixFileMappingReader($sourceDirectory, $targetDirectory, $mappingFilePaths);
19+
20+
// Get an installer, supply with the file mapping reader.
21+
$installer = new FileInstaller($reader);
22+
23+
// Install according to mapping, supply with Composer IOInterface.
24+
$installer->install($io);
25+
```

0 commit comments

Comments
 (0)