webdevvie/pakket 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

webdevvie/pakket

最新稳定版本:1.2.5

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

统计信息

  • 总下载量: 1.7k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2018-07-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固