PharPHP packaging Tool

Source: Internet
Author: User
PharPHP packaging tool none #! Usrbinenvphp? Phpdefine (PHAR_BUILDER_VERSION, 0.1.0); functionusage ($ self, $ lnPHP_EOL) {echoUsage: {$ self} phar [options] {$ ln}; must-be-createdarchive. {$ ln };

PharPHP packaging tool none #! /Usr/bin/env php? Phpdefine ("PHAR_BUILDER_VERSION", "0.1.0"); function usage ($ self, $ ln = PHP_EOL) {echo "Usage: {$ self} phar [options] {$ ln} "; echo" phar Path to an existing Phar archive or to-be-created archive. {$ ln }";

Phar PHP packaging Tool <无>
#! /Usr/bin/env php
  0) {//-p = value -- param = value list ($ arg_name, $ arg_value) = explode ('=', ltrim ($ arg, '-'), 2); $ ret [$ arg_name] = $ arg_value; continue;} if ($ arg {0 }! = '-') {Continue;} if ($ arg {1 }! = '-') & Isset ($ arg {2}) {//-pVALUE $ ret [$ arg {1}] = substr ($ arg, 2 ); continue;} else if (isset ($ argv [$ I + 1]) & ($ argv [$ I + 1] {0 }! = '-') & (False = strpos ($ arg, '=') {$ ret [ltrim ($ arg, '-')] = $ argv [$ I + 1]; ++ $ I;} else {$ ret [ltrim ($ arg, '-')] = true ;}} return $ ret;} info ("Phar Builder ". PHAR_BUILDER_VERSION); if ('cli '! = PHP_SAPI) {error ("Run for command line only. ") ;}if (false ==== Phar: canWrite () {error (" Phar can not write, Set \ "phar. readonly = Off \ "in php. ini. ") ;}$ self = array_shift ($ argv); if (empty ($ argv [0]) {usage ($ self );} $ path = array_shift ($ argv); $ args = args_parse ($ argv); $ stub = empty ($ args ['Stub'])? '': $ Args ['job']; $ flags = 0; $ files = empty ($ args ['files'])? '': $ Args ['files']; $ alias = empty ($ args ['Alias'])? Basename ($ path): $ args ['Alias']; $ regex = empty ($ args ['filter'])? Null: $ args ['filter']; $ base_dir = empty ($ args ['path'])? '': $ Args ['path']; $ arg_compress = empty ($ args ['compress'])? '': $ Args ['companys']; $ index = empty ($ args ['index'])? '': $ Args ['index']; $ webindex = empty ($ args ['webindex'])? '': $ Args ['webindex']; switch ($ arg_compress) {case 'gz ': $ compress = Phar: gz; $ compress_type = 'gz'; break; case 'bz2': $ compress = Phar: bz2; $ compress_type = 'bz2'; break; default: $ compress = Phar: NONE; $ compress_type = 'none '; break;} if (! Empty ($ base_dir )&&! Is_dir ($ base_dir) {error ("Dir not Exists! ");} Try {$ p = new Phar ($ path, $ flags, $ alias); $ p-> startBuffering (); $ p-> compress ($ compress ); info ("API Version :". phar: apiVersion (); info ("File: {$ path}"); info ("Alias: {$ alias}"); info ("Compress: {$ compress_type} "); if (! Empty ($ base_dir) {info ("Build From: {$ base_dir}"); if ($ regex) {info ("Filter: {$ regex }");} $ p-> buildFromDirectory ($ base_dir, $ regex);} if (! Empty ($ files) {foreach (explode (',', $ files) as $ file) {info ("Add File: {$ file }"); $ p-> addFile ($ file, basename ($ file) ;}} if ($ index & $ webindex) {info ("Index :{$ index }"); info ("Web Index: {$ webindex}"); $ p-> setDefaultStub ($ index, $ webindex);} else if ($ index) {info ("Index: {$ index} "); $ p-> setdefastustub ($ index);} else if ($ webindex) {info (" Web Index :{$ webindex }"); $ p-> setdefastustub (null, $ webindex);} if ($ stub) {info ("Stub: {$ stub}"); if (is_file ($ stub )) {$ stub = file_get_contents ($ stub) ;}$ p-> setStub ($ stub) ;}$ p-> stopBuffering (); info ("Files: {$ p-> count ()} ");} catch (\ Exception $ e) {error ($ e-> getMessage ());}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.