承接 lovullo/phpqaconfig 相关项目开发

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

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

lovullo/phpqaconfig

最新稳定版本:1.1.11

Composer 安装命令:

composer require lovullo/phpqaconfig

包简介

PHP QA and development tool configuration for LoVullo Associates.

README 文档

README

Configuration for QA and development tools specific to the coding standards at LoVullo Associates. This package, combined with lovullo/phpqatools is meant to be a base for new PHP projects.

Installation

Simply require it in your project's composer.json

    "require-dev": {
        "lovullo/phpqaconfig": "@stable"
    }

Or

$ composer require --dev lovullo/phpqaconfig

Usage

Project Setup

Create a build.xml file in your project root with the following contents:

<?xml version="1.0" encoding="utf-8"?>
<project name="project-name">
  <import file="${basedir}/vendor/lovullo/phpqaconfig/build.xml" />
</project>

Create a phpunit.xml file in your project root with the following contents:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit verbose="true">
  <testsuites>
    <testsuite name="ProjectName">
      <directory suffix="Test.php">tests/</directory>
    </testsuite>
  </testsuites>

  <logging>
    <log type="coverage-html" target="build/coverage"/>
    <log type="coverage-clover" target="build/logs/clover.xml"/>
    <log type="coverage-crap4j" target="build/logs/crap4j.xml"/>
    <log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/>
  </logging>
</phpunit>

See the "Customizing" section below if you have an existing PHPUnit configuration elsewhere.

Development

When developing, use the following ant targets:

  • composer
  • phpunit
  • phpcs
  • phpmd
  • phpcpd
  • phploc

For example:

$ ant phpcs phpmd phpcpd

Continuous Integration

When configuring Continuous Integration (ie. Jenkins), composer must download and install this repo before you can run ant tasks. Add an "Execute Shell" build step to Jenkins with the following command:

$ composer install -o

Next, add an "Invoke Ant" build step with the following target:

build-qa

This will run check_mergeconflicts, phplint, phpunit, phpcs-ci, pdepend, phpmd-ci, phpcpd-ci, phploc-ci, and phpdox.

For jobs that need to run quickly and only need a minimal number of QA checks, run the following targets instead:

build-quick

This will run check_mergeconflicts, phplint, and phpunit.

Add additional build targets to your build.xml file as appropriate for your particular project.

Customizing

QA Tools Location

The included build.xml assumes that all the QA tools are installed into ./vendor/bin. If they are installed elsewhere, provide a toolsdir property to their location:

<?xml version="1.0" encoding="utf-8"?>
<project name="project-name">
  <property name="toolsdir" value="${basedir}/bin/" />

  <import file="${basedir}/vendor/lovullo/phpqaconfig/build.xml" />
</project>

PHP Lint Configuration

By default, the included build.xml runs php -l on all PHP files in the project except for the vendor/ directory in the root of your project. You can override this setting using the phplintignore property:

<?xml version="1.0" encoding="utf-8"?>
<project name="project-name">
  <property name="phplintignore" value="components/**/*,vendor/**/*" />

  <import file="${basedir}/vendor/lovullo/phpqaconfig/build.xml" />
</project>

PHPUnit Configuration

By default, the included build.xml assumes that there is a phpunit.xml file in the same directory as itself. If you already have a phpunit.xml file located somewhere else, you can override the configuration as follows:

<?xml version="1.0" encoding="utf-8"?>
<project name="project-name">
  <property name="phpunitconfig" value="${basedir}/app/" />

  <import file="${basedir}/vendor/lovullo/phpqaconfig/build.xml" />
</project>

PHP_CodeSniffer Configuration

You can customize the files that are ignored in phpcs checks by specifying a phpcsignore property:

<?xml version="1.0" encoding="utf-8"?>
<project name="project-name">
  <property name="phpcsignore" value="app/,bin/,vendor/,web/" />

  <import file="${basedir}/vendor/lovullo/phpqaconfig/build.xml" />
</project>

By default, only the vendor directory is excluded from checks.

You can change what PHP_CodeSniffer standard uses by overriding the phpcsstandard property:

<?xml version="1.0" encoding="utf-8"?>
<project name="project-name">
  <property name="phpcsstandard" value="PSR1,PSR2" />

  <import file="${basedir}/vendor/lovullo/phpqaconfig/build.xml" />
</project>

PHPMD Configuration

You can customize the files that are ignored in phpmd checks by specifying a phpmdignore property:

<?xml version="1.0" encoding="utf-8"?>
<project name="project-name">
  <property name="phpmdignore" value="app,bin,vendor,web" />

  <import file="${basedir}/vendor/lovullo/phpqaconfig/build.xml" />
</project>

By default, only the vendor directory is excluded from checks.

PHPCPD Configuration

You can customize the files that are ignored in phpcpd checks by specifying a phpcpdignore property:

<?xml version="1.0" encoding="utf-8"?>
<project name="project-name">
  <property name="phpcpdignore" value="--exclude vendor --exclude app" />

  <import file="${basedir}/vendor/lovullo/phpqaconfig/build.xml" />
</project>

By default, only the vendor directory is excluded from checks.

phpDox Configuration

<?xml version="1.0" encoding="utf-8" ?>
<phpdox xmlns="http://xml.phpdox.net/config" silent="true">
    <bootstrap />

    <project name="phpdox" source="${basedir}/src" workdir="${basedir}/build/phpdox/xml">
        <collector publiconly="false" backend="parser">
            <include mask="*.php" />
            <inheritance resolve="true" />
        </collector>

        <generator output="${basedir}/build/docs">
            <enrich base="${basedir}/build">
                <source type="build" />

                <source type="phploc">
                    <file name="logs/phploc.xml" />
                </source>

                <source type="git">
                    <git binary="git" />
                    <history enabled="true" limit="15" cache="${phpDox.project.workdir}/gitlog.xml" />
                </source>

                <source type="checkstyle">
                    <file name="logs/checkstyle.xml" />
                </source>

                <source type="phpunit">
                    <file name="logs/phpunit" />
                </source>

                <source type="pmd">
                    <file name="logs/pmd.xml" />
                </source>
            </enrich>

            <build engine="html" enabled="true" output="html">
                <template dir="${phpDox.home}/templates/html" />
                <file extension="html" />
            </build>
        </generator>
    </project>
</phpdox>

Disabling QA Checks

If you do not want certain QA tools to run for a project, add one or more of the following disable properties prior to including the base build.xml file:

<?xml version="1.0" encoding="utf-8"?>
<project name="project-name">
  <property name="disable-phpunit" value="true" />
  <property name="disable-pdepend" value="true" />
  <property name="disable-phpmd" value="true" />
  <property name="disable-phpcs" value="true" />
  <property name="disable-phpcpd" value="true" />

  <import file="${basedir}/vendor/lovullo/phpqaconfig/build.xml" />
</project>

lovullo/phpqaconfig 适用场景与选型建议

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

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2014-11-18