humbug/box 问题修复 & 功能扩展

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

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

humbug/box

Composer 安装命令:

composer require humbug/box

包简介

Fast, zero config application bundler with PHARs.

关键字:

README 文档

README

Box logo

Package version Scrutinizer Code Quality Slack License

Upgrading from Box2? Checkout the upgrade guide!

Goal

The Box application simplifies the PHAR building process. Out of the box (no pun intended), the application can do many great things:

  • ⚡ Fast application bundling
  • 🔨 PHAR isolation
  • ⚙️ Zero configuration by default
  • 🚔 Requirements checker
  • 🚨 Friendly error logging experience
  • 🔍 Retrieve information about the PHAR extension or a PHAR file and its contents (box info or box diff)
  • 🔐️ Verify the signature of an existing PHAR (box verify)
  • 📝 Use Git tags and short commit hashes for versioning
  • 🕵️️ Get recommendations and warnings about regarding your configuration (box validate)
  • 🐳 Docker support (box docker)

For the full documentation see https://box-project.github.io/box.

Table of Contents

  1. Installation
    1. Phive
    2. Composer
    3. Homebrew
    4. GitHub
    5. Docker
    6. shivammathur/setup-php (GitHub Actions)
  2. Usage
  3. Configuration
    1. Base path (base-path)
    2. Main (main)
    3. Output (output)
    4. Permissions (chmod)
    5. Check requirements (check-requirements)
    6. Including files
      1. Force auto-discovery (force-autodiscovery)
      2. Files (files and files-bin)
      3. Directories (directories and directories-bin)
      4. Finder (finder and finder-bin)
      5. Blacklist (blacklist)
      6. Excluding the Composer files (exclude-composer-files)
      7. Excluding dev files (exclude-dev-files)
      8. Map (map)
    7. Stub
      1. Stub (stub)
      2. Alias (alias)
      3. Shebang (shebang)
      4. Banner (banner)
      5. Banner file (banner-file)
    8. Forcing the timestamp (timestamp)
    9. Dumping the Composer autoloader (dump-autoload)
    10. Compactors (compactors)
      1. Annotations (annotations)
      2. PHP-Scoper (php-scoper)
    11. Compression algorithm (compression)
    12. Security
      1. Signing algorithm (algorithm)
      2. The private key (key)
      3. The private key password (key-pass)
    13. Metadata (metadata)
    14. Replaceable placeholders
      1. Replacements (replacements)
      2. Replacement sigil (replacement-sigil)
      3. Datetime placeholder (datetime)
      4. Datetime placeholder format (datetime-format)
      5. Pretty git commit placeholder (git)
      6. Git commit placeholder (git-commit)
      7. Short git commit placeholder (git-commit-short)
      8. Git tag placeholder (git-tag)
      9. Git version placeholder (git-version)
  4. Requirements checker
    1. Configuration
      1. PHP version requirements
      2. Extension configuration requirements
      3. Polyfills
    2. Integration with a custom stub
  5. Optimize your PHAR
    1. Review your files
    2. Compress your PHAR
    3. Optimize your code
  6. PHAR code isolation
    1. Why/Explanation
    2. Isolating the PHAR
    3. Debugging the scoping
  7. Docker support
  8. Symfony support
    1. Project files
    2. Project directory
    3. Cache
  9. Reproducible builds
    1. Creating a reproducible PHAR
      1. PHP-Scoper
      2. Composer
        1. Composer root version
        2. Composer autoload suffix
      3. Box
        1. PHAR alias
        2. Requirement Checker
        3. Box banner
        4. Sort compiled files
      4. PHAR
    2. Usages
  10. PHAR signing best practices
    1. Built-in PHAR API
      1. How to sign your PHAR
      2. How it works
      3. Why it is bad
    2. How to (properly) sign your PHAR
      1. Create a new GPG-key
      2. Manually signing
      3. Generate the encryption key
      4. Secure your encryption key
      5. Sign your PHAR
      6. Verifying the PHAR signature
    3. Automatically sign in GitHub Actions
  11. FAQ
    1. What is the canonical way to write a CLI entry file?
      1. The shebang
      2. The PHP_SAPI check
      3. Autoloading Composer
    2. Detecting that you are inside a PHAR
    3. Building a PHAR with Box as a dependency
  12. Contributing
  13. Upgrade guide
  14. Backward Compatibility Promise (BCP)
  15. Credits

Usage

Creating a PHAR should be as simple as running box compile (no config required!). It will however assume some defaults that you might want to change. Box will by default be looking in order for the files box.json and box.json.dist in the current working directory. A basic configuration could be for example changing the PHAR permissions:

{
    "chmod": "0700"
}

You can then find more advanced configuration settings in the configuration documentation. For more information on which command or options is available, you can run:

box help

Contributing

The project provides a Makefile in which the most common commands have been registered such as fixing the coding style or running the test.

make

Backward Compatibility Promise (BCP)

The policy is for the major part following the same as Symfony's one. Note that the code marked as @private or @internal are excluded from the BCP.

The text displayed by the commands (e.g. compile or info) or the content of the error/exception messages are also not subject to the BCP.

Credits

Project originally created by: Kevin Herrera (@kherge) which has now been moved under the Humbug umbrella.

humbug/box 适用场景与选型建议

humbug/box 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 878.18k 次下载、GitHub Stars 达 1.31k, 最近一次更新时间为 2017 年 11 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「phar」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 humbug/box 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 humbug/box 我们能提供哪些服务?
定制开发 / 二次开发

基于 humbug/box 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 1312
  • Watchers: 22
  • Forks: 110
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-11-12