我有构建php应用程序的问题。
目标'构建'在此项目中不存在
在netbeans php项目中。
使用ubuntu os在netbeans IDE中发送使用composer构建phar的所有prosedures
答案 0 :(得分:1)
Netbeans有插件,您可以安装NBPhar,这将帮助您创建.phar
文件。
您可以按照以下步骤创建.phar
文件:
使用以下代码在myapp根目录中创建一个名为create-phar.php的新PHP文件:
<?php
$srcRoot = "~/myapp/src";
$buildRoot = "~/myapp/build";
$phar = new Phar($buildRoot . "/myapp.phar",
FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::KEY_AS_FILENAME, "myapp.phar");
$phar["index.php"] = file_get_contents($srcRoot . "/index.php");
$phar["common.php"] = file_get_contents($srcRoot . "/common.php");
$phar->setStub($phar->createDefaultStub("index.php"));
copy($srcRoot . "/config.ini", $buildRoot . "/config.ini");
然后打开一个终端窗口,导航到myapp目录并运行它:
$ php create-phar.php
有关详细说明,请参阅此文Packaging Your Apps with Phar。