Skip to content

Commit 0207c98

Browse files
committed
composer post install script
Signed-off-by: MarioRadu <[email protected]>
1 parent 569f381 commit 0207c98

File tree

3 files changed

+37
-96
lines changed

3 files changed

+37
-96
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
6+
7+
function copyFile(array $file): void
8+
{
9+
if (is_readable($file['destination'])) {
10+
echo "File {$file['destination']} already exists." . PHP_EOL;
11+
} else {
12+
if (! copy($file['source'], $file['destination'])) {
13+
echo "Cannot copy {$file['source']} file to {$file['destination']}" . PHP_EOL;
14+
} else {
15+
echo "File {$file['source']} copied successfully to {$file['destination']}." . PHP_EOL;
16+
}
17+
}
18+
}
19+
20+
$files = [
21+
[
22+
'source' => 'config/autoload/local.php.dist',
23+
'destination' => 'config/autoload/local.php',
24+
],
25+
[
26+
'source' => 'config/autoload/local.test.php.dist',
27+
'destination' => 'config/autoload/local.test.php',
28+
],
29+
[
30+
'source' => 'vendor/dotkernel/dot-mail/config/mail.global.php.dist',
31+
'destination' => 'config/autoload/mail.global.php',
32+
],
33+
];
34+
35+
array_walk($files, 'copyFile');

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@
104104
},
105105
"scripts": {
106106
"post-install-cmd": [
107-
"@development-enable"
107+
"@development-enable",
108+
"php bin/composer-post-install-script.php"
108109
],
109110
"development-disable": "laminas-development-mode disable",
110111
"development-enable": "laminas-development-mode enable",

config/autoload/mail.local.php.dist

Lines changed: 0 additions & 95 deletions
This file was deleted.

0 commit comments

Comments
 (0)