简体   繁体   中英

How to generate .phar in netbeans

I have a problem of building the php appliction.

Target 'build' does not exist in this project

in netbeans php project.

Just send what are all the prosedures to build a phar along with composer in netbeans IDE using ubuntu os

Netbeans has plugins, you can install NBPhar , which will help you to create .phar file.


You can create .phar file by following below steps :

Create a new PHP file named create-phar.php in your myapp root with the following code:

<?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");

Then open a terminal window, navigate to the myapp directory and run it:

$ php create-phar.php

Refer this article Packaging Your Apps with Phar for detailed explanation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM