getPlugins()->apply("php"); $project->setConfig(function ($c) { $c->setEntry("com/example/script/primary.php"); $c->setPackageName("com.example.script.php"); $c->setLogo("logo.png"); }); $project->getTasks()->add("taskName", function ($task) use ($console) { // 添加属性 $task->getInputs()->addProperty("enabled", false, false); $task->getActions()->add("actionName", function ($action) use ($console) { $action->onPerform(function () use ($console, $action) { $console->log("taskName." . $action->getName() . " onPerform"); }); }); // 只有在有输入属性 enabled 时才会执行 $task->onlyIf(function () use ($task) { return $task->getInputs()->getProperty("enabled") == true; }); });