承接 cyberspectrum/pharpiler 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

cyberspectrum/pharpiler

Composer 安装命令:

composer create-project cyberspectrum/pharpiler

包简介

Creates a phar from any composer based project - highly configurable

README 文档

README

Build Status Latest Version tagged Latest Version on Packagist Installations via composer per month

What is Pharpiler?

Pharpiler is a simple, yet highly configurable, command line tool to compile composer based php projects into a phar file.

Why Pharpiler?

I (@discordier) got tired of writing custom compile scripts for each and every phar project I was developing over and over again which mostly consisted of copy&paste code from each project. Hence there definately was need for reduction of code duplication and so Pharpiler was born.

How to use?

In your project run composer require --dev cyberspectrum/pharpiler and create a .pharpiler.yml in your project root.

Configuration

The .pharpiler.yml allows for many configuration options, have a look at the configuration of Pharpiler itself in this repository (yes, Pharpiler compiles itself).

Within the configuration you may use certain parameters.

You may define own parameters in the root level to reduce recurrences. Example:

parameters:
  - my-parameter: "Hello World"

However, Pharpiler registers some parameters for each package to ease configuration. Package root dir: %package:[vendor]/[package-name]% Package version: %version:[vendor]/[package-name]% Package release date: %date:[vendor]/[package-name]%

# First off, tell what the desired phar name should be.
phar: pharpiler.phar

# Now we need to declare some compile tasks.
tasks:
  # We want to add a composer package.
  - type: add-package

    # The name of the package.
    # NOTE: you most likely. want to add your root package here as first.
    name: cyberspectrum/pharpiler

    # Optional flag to include all requirements of the package
    # default: true
    # You may specify a list of package names instead of true or false.
    # include_require: true

    # Optional flag to include all development requirements of the package.
    # default: false
    # You may specify a list of package names instead of true or false.
    # include_requiredev: false

    # Optionally list package names that shall get omitted.
    exclude_dependencies:
    #  - phpcq/all-tasks

    # Define file name pattern for files to get included.
    # You can specify glob and regex patterns here.
    # NOTE: this example makes use of YAML references.
    include_files: &default_include_files
      # Include all php files.
      - "*.php"
      # Include all the license files.
      - "(LICENSE\\.?.*)"
    # Define file name patterns of files to exclude.
    # You can specify glob and regex patterns here.
    # NOTE: this example makes use of YAML references.
    exclude_files: &default_exclude_files
      # We do not want to include unit tests.
      - "(.*[Tt]ests?\/)"
      - "*tests/*.php"

    # You may override the "include_files", "exclude_files" on a per package 
    # basis and can even move files around by specifying "rewrite_paths".
    package_override:
      # Override settings for package "cyberspectrum/pharpiler"
      cyberspectrum/pharpiler:
        include_files:
          # Import the previously defined default includes.
          - *default_include_files
          # Additionally add the file "bin/pharpiler" from said package.
          - "%package:cyberspectrum/pharpiler%/bin/pharpiler"
        exclude_files:
          # Import the previously defined default excludes.
          - *default_exclude_files
          # Additionally omit the files within phar directories.
          - "*/phar/*"
        rewrite_paths:
          # Here you can rewrite path portions.
          src: /src

      # Symfony has some tester classes we do not want to add - so let's skip them.
      symfony/console:
        exclude_files:
          - *default_exclude_files
          - "(Tester\/)"

  # A real phar file needs a stub, here you tell pharpiler to set it.
  - type: set-stub
    # The stub file must be accessible from anywhere within the composer project.
    stub_file: %package:cyberspectrum/pharpiler%/phar/stub.php

  # We most of the times also need to add the autoload information.
  - type: composer-autoload
    # Pharpiler can optimize the autoload information to remove anything which
    # got excluded by any other setting.
    # Default: true
    optimize: true

# For some files it is necessary to alter the file contents.
# To do so, you may specify a list of filters which alter file contents.
# Currently there are the following types of filters registered:
# - replace      Which performs simple search and replace on the file contents.
# - php-strip    Which removes all comments and trailing whitespace while
#                maintaining line numbers.
# - warning-time Creates a timestamp in the future - useful for selfupdate
#                notices etc.
rewrites:
    # Define the file names to be matched by this rewrite.
  - files:
      - %package:cyberspectrum/pharpiler%/phar/stub.php
      - %package:cyberspectrum/pharpiler%/bin/pharpiler
    # Define a list of filters to apply on these files.
    filter:
      # Search for "@@MIN_PHP_VERSION@@" and replace it with "5.5"
      - type: replace

        @@MIN_PHP_VERSION@@: "5.5"
      # Search for "@@PHARPILER_VERSION@@" and replace it with the installed version.
      - type: replace
        @@PHARPILER_VERSION@@: %version:cyberspectrum/pharpiler%

      # Search for "// @@DEV_WARNING_TIME@@" and replace it with the given define.
      # The magic value "@@warning_time@@" will get replaced with the calculated timestamp.
      - type: warning-time
        search: // @@DEV_WARNING_TIME@@
        format: define('DEV_WARNING_TIME', @@warning_time@@);
        # The ahead value is: 30 * 24 * 3600 = 2592000, hence 30 days.
        ahead: 2592000

  # This removes the shebang line from the passed script.
  - files:
      - %package:cyberspectrum/pharpiler%/bin/pharpiler
    filter:
      - type: replace
        "#!/usr/bin/env php\n": ""

  # You most likely want to keep the php-strip filter at the end as otherwise 
  # comments will get stripped that should get replaced by other filters, like
  # the "warning-time".
  - files: "*.php"
    filter:
      - type: php-strip

cyberspectrum/pharpiler 适用场景与选型建议

cyberspectrum/pharpiler 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 249 次下载、GitHub Stars 达 6, 最近一次更新时间为 2015 年 11 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-11-24