根据一个开源工具得到的灵感,使用流打包,并使用token_get_all移除了所用php文件的空白。现在打包出来只有93k了。谢谢关注。
我一个简单的文件,加上一个symfony的process包,打包出来竟有125m之巨,而composer那么多文件打包出来只有1.6m,百思不得其解。附上打包代码:
getmessage(), php_eol;} catch (badmethodcallexception $e) { echo $e->getmessage(), php_eol;}e('building...');$phar->buildfromdirectory(__dir__);e('remove unused files...');array_walk($ignorefiles, function ($file) use ($phar) { $phar->delete($file);});e('set stub...');$phar->setstub($phar->createdefaultstub('deploy.php', 'deploy.php'));e('compress...');$phar->compressfiles(phar::bz2);e('build done.');function e($string){ echo $string, php_eol;}
回复内容: 根据一个开源工具得到的灵感,使用流打包,并使用token_get_all移除了所用php文件的空白。现在打包出来只有93k了。谢谢关注。
我一个简单的文件,加上一个symfony的process包,打包出来竟有125m之巨,而composer那么多文件打包出来只有1.6m,百思不得其解。附上打包代码:
getmessage(), php_eol;} catch (badmethodcallexception $e) { echo $e->getmessage(), php_eol;}e('building...');$phar->buildfromdirectory(__dir__);e('remove unused files...');array_walk($ignorefiles, function ($file) use ($phar) { $phar->delete($file);});e('set stub...');$phar->setstub($phar->createdefaultstub('deploy.php', 'deploy.php'));e('compress...');$phar->compressfiles(phar::bz2);e('build done.');function e($string){ echo $string, php_eol;}
我觉得你可以将格式转换为zip;然后通过压缩软件查看归档内容;这样你可以直观的看到归档中各组件大小;
$phar->converttoexecutable(phar::zip);
希望可以帮到你