PHP编写器脚本don';t火
我正在尝试让安装后和更新后脚本在Composer包中工作。以下是PHP编写器脚本don';t火,php,composer-php,Php,Composer Php,我正在尝试让安装后和更新后脚本在Composer包中工作。以下是composer.json文件的摘录: "autoload": { "psr-4": { "App\\": "src/" } }, "scripts": { "post-update-cmd": [ "App\\Install\\ComposerScripts::postUpdate" ], "post-install-cmd": [ "App
composer.json
文件的摘录:
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"scripts": {
"post-update-cmd": [
"App\\Install\\ComposerScripts::postUpdate"
],
"post-install-cmd": [
"App\\Install\\ComposerScripts::postInstall",
"./test.sh"
]
}
下面是composerscript.php
:
<?php
namespace App\Install;
use Composer\Script\Event;
class ComposerScripts
{
public static function postInstall(Event $event)
{
$io = $event->getIO();
if ($io->askConfirmation('Install Mecab? ', false)) {
return true;
}
exit;
}
public static function postUpdate(Event $event)
{
$event->getIO()->write("Working!");
return true;
}
}
如果我使用composer run script
对composer脚本方法进行测试,并且test.sh
脚本工作正常,但是当我安装或更新软件包时,什么都没有发生。没有输出,没有错误,什么都没有。知道这里发生了什么吗?试试看
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"scripts": {
"post-update-cmd": [
"App\\Install\\ComposerScripts::postUpdate"
],
"post-install-cmd": [
"App\\Install\\ComposerScripts::postInstall",
"bash test.sh"
]
}
谢谢,但我试过了,还是什么都没有。即使我删除了test.sh脚本,即使两个Composer脚本方法应该启动,也不会发生任何事情。作为一个健全性检查,您正在运行哪些命令来安装或更新包?
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"scripts": {
"post-update-cmd": [
"App\\Install\\ComposerScripts::postUpdate"
],
"post-install-cmd": [
"App\\Install\\ComposerScripts::postInstall",
"bash test.sh"
]
}