承接 filipefernandes/laravel-type-coverage 相关项目开发

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

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

filipefernandes/laravel-type-coverage

Composer 安装命令:

composer require filipefernandes/laravel-type-coverage

包简介

Laravel code coverage tool for PHPDoc and type declarations

README 文档

README

Laravel Type Coverage is a package that helps you ensure your codebase has proper type hints and PHPDoc coverage. It analyzes your PHP files for missing type hints and doc comments, generating a report with insights on which functions need improvement.

Features

  • Analyze your codebase for functions without PHPDoc and missing type hints.
  • Display detailed coverage information with suggestions for improvement.
  • Export the results to a JSON file.
  • Supports configurable paths and exclusions for scanning.
  • Command-line interface for easy integration into your workflow.

Installation

1. Install via Composer

To install the package, run the following command in your Laravel project:

composer require filipefernandes/laravel-type-coverage --dev

2. Publish Configuration (Optional)

If you want to customize the default configuration for the paths to scan, exclusions, or export options, you can publish the configuration file:

php artisan vendor:publish --provider="Filipefernandes\LaravelTypeCoverage\LaravelTypeCoverageServiceProvider" --tag="config"

This will create a config/type-coverage.php file where you can adjust the settings.

Usage

Run the Command

You can run the coverage analysis command with:

php artisan laravel-type-coverage:run

This command will scan your project for PHP functions and check if they have both type hints and PHPDoc comments. It will display a report in the terminal, showing the missing type hints and PHPDoc, along with suggested improvements.

Command Options:

  • --path: Comma-separated list of paths to scan (e.g., app,src). If not provided, it will default to app.
  • --fail-under: Set the minimum coverage percentage required to pass (default: 80).
  • --ignore: Comma-separated list of paths to ignore.
  • --export: Export the report to a file (default is true).

Example Usage:

php artisan laravel-type-coverage:run --path=app,src --fail-under=90 --export

Output Example:

When you run the command, you’ll see output like this:

Running Laravel Type Coverage...
Scanning for PHP files...

--------------------------------------------------------------------------------------------
  File   app/Models/ZipCode.php
--------------------------------------------------------------------------------------------
  Line   Message
--------------------------------------------------------------------------------------------
  :83    ⚠️  Method getFullZipCodeAttribute is missing type hints.
         💡 Consider adding type declarations or PHPDoc for better coverage.
  :92    ⚠️  Method getFullZipCodeInfoAttribute is missing PHPDoc and missing type hints.
         💡 Consider adding type declarations or PHPDoc for better coverage.
--------------------------------------------------------------------------------------------

Coverage: 85%

Exporting Results:

By default, the tool will export the results to laravel-type-coverage.json in your project’s root directory. You can customize the export path in the configuration file.

Example Export:

If you want to specify a custom export path:

php artisan laravel-type-coverage:run --export=/path/to/export.json

Configuration

The configuration file config/type-coverage.php contains the following options:

  • paths: Array of paths to scan (default: ['app']).
  • ignore: Array of paths to ignore (default: []).
  • fail_under: Minimum coverage percentage required to pass (default: 80).
  • export: Whether to export the results to a JSON file (default: true).
  • export_path: The directory or path to export the coverage report (default: current directory).

Example:

return [
    'paths' => ['app', 'src'],
    'ignore' => ['vendor', 'storage'],
    'fail_under' => 85,
    'export' => true,
    'export_path' => 'coverage_reports/',
];

Contributing

Contributions are welcome! If you'd like to contribute to the package, feel free to open a pull request with your changes.

License

This package is open-source software licensed under the MIT License.

filipefernandes/laravel-type-coverage 适用场景与选型建议

filipefernandes/laravel-type-coverage 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.25k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 04 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 filipefernandes/laravel-type-coverage 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-15