webdevvie/pakket
Composer 安装命令:
composer require webdevvie/pakket
包简介
Makes phar files from either inside your project or... outside of it as a phar itself!
README 文档
README
Pakket is the Dutch word for package. This tool will help you package your project into a PHAR file.
It is meant to be framework agnostic. It does not include update code (for downloading new versions of the phar with the phar itself Look elsewhere for that It just makes PHAR files.
This is the initial version. I suggest not using it for production just yet.
How to use as a library
Either include the package using composer using :
composer require webdevvie/pakket
Create your phar stub (the thing that calls your other files inside your phar file) and call it "stub"
Then create a builder object
<?php include("vendor/autoload.php"); $builder = new \Webdevvie\Pakket\Builder(); $config = [ "stubFile"=>__DIR__."/stub" ]; $builder->build( __DIR__, __DIR__."/yourphar.phar", $config )
And you are off to the races!
Of course you may not want to include everything and the kitchen sink into your phar. (Making a "Homer") You can exclude these by filling the key "exclude" with an array of regular expressions (these are thrown through preg_match)
How to use as a phar
Download a prebuilt pakket.phar from here(todo get a place to host the phar files)
Create a pakket.json with the correct configuration.
This is a sample pakket.json that is used for pakket itself
{
"exclude": [
"/^Tests/i",
"/^coverage/i",
"/^yourphar.phar/i",
"/^yourphar-(.*)\\.phar/i",
"/^Tests\\/(.*)/i",
"/^.git/i",
"/^(.*)\\/.git/i",
"/\\.gitignore/i",
"/\\.travis.yml/i"
],
"parse": [
"/^console/i"
],
"targetPath": "yourphar.phar",
"stubFile": "stub",
"vars": {}
}
In this case we create the file yourphar.phar parsing the /console file to include the default variables.
Create your phar stub (the thing that calls your other files inside your phar file) and call it "stub"
Now run pakket.phar
./pakket.phar build .
Here the command is build the path to work with is . (current directory) the output file is yourphar.phar
You can also specify the output (say you want to specify a target file in command line with automated builds)
./pakket.phar build . output.phar
Here the command is build the path to work with is . (current directory) the output file is yourphar-1.0.phar
TODO
The following things are still todos :
- A setup command that configures the pakket.json file
- A better help text
- Get a place to host the .phar file
webdevvie/pakket 适用场景与选型建议
webdevvie/pakket 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.71k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2018 年 07 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 webdevvie/pakket 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 webdevvie/pakket 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.71k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2018-07-07