定制 developer-samuel/php-codestats 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

developer-samuel/php-codestats

最新稳定版本:1.1.0

Composer 安装命令:

composer require developer-samuel/php-codestats

包简介

A high-performance, strictly typed CLI tool for fast source code volume metrics (files, lines, and characters).

README 文档

README

Command-line tool for analyzing source code metrics: files, lines, and characters.

Installation

Install as a development dependency via Composer:

composer require --dev developer-samuel/php-codestats

Configuration

A configuration file codestats-analyzer.xml is required in the project root. It defines:

  • file_extensions - file types to include.
  • ignored_dirs - directories to skip.

You can bootstrap it automatically from the library:

php -r "require 'vendor/autoload.php'; DeveloperSamuel\PhpCodeStats\Installer::copyConfig();"

Or copy it manually from vendor/developer-samuel/php-codestats/config/analyzer.xml to your project root.

Example codestats-analyzer.xml

<?xml version="1.0" encoding="UTF-8"?>
<analyzer>
    <file_extensions>
        <ext>php</ext>
        <ext>js</ext>
        <ext>css</ext>
    </file_extensions>
    <ignored_dirs>
        <dir>bin</dir>
        <dir>vendor</dir>
        <dir>node_modules</dir>
        <dir>public</dir>
    </ignored_dirs>
</analyzer>

Usage

Three commands are available:

# Count stats
php vendor/bin/count-stats

# Count files
php vendor/bin/count-files

# Count lines
php vendor/bin/count-lines

# Count characters
php vendor/bin/count-chars

Commands automatically use the codestats-analyzer.xml in your project root.

Notes

  • The config file can be edited to add/remove extensions or ignored directories.
  • Using php -r "Installer::copyConfig();" is enough to bootstrap the default config. No need to write manually unless you want custom changes.
  • Ideal for integrating into CI/CD or dev workflow to monitor project metrics.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固