PHPackages                             filipefernandes/laravel-type-coverage - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. filipefernandes/laravel-type-coverage

ActiveLibrary[Testing &amp; Quality](/categories/testing)

filipefernandes/laravel-type-coverage
=====================================

Laravel code coverage tool for PHPDoc and type declarations

v1.0.17(1y ago)01.2kMITPHPPHP ^8.0

Since Apr 15Pushed 1y ago1 watchersCompare

[ Source](https://github.com/filipefernandes9747/laravel-type-coverage)[ Packagist](https://packagist.org/packages/filipefernandes/laravel-type-coverage)[ RSS](/packages/filipefernandes-laravel-type-coverage/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (14)Used By (0)

Laravel Type Coverage
=====================

[](#laravel-type-coverage)

**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
--------

[](#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
------------

[](#installation)

### 1. Install via Composer

[](#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)

[](#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
-----

[](#usage)

### Run the Command

[](#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:

[](#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:

[](#example-usage)

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

### Output Example:

[](#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:

[](#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:

[](#example-export)

If you want to specify a custom export path:

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

Configuration
-------------

[](#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
------------

[](#contributing)

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

License
-------

[](#license)

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

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance48

Moderate activity, may be stable

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

13

Last Release

386d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/44c4a0ab684a6ff2f571c5b6b1db79320570f053120dadb2793c9b8ee41529a3?d=identicon)[filipe9747](/maintainers/filipe9747)

---

Top Contributors

[![ffernandes9747](https://avatars.githubusercontent.com/u/106343739?v=4)](https://github.com/ffernandes9747 "ffernandes9747 (27 commits)")[![filipefernandes9747](https://avatars.githubusercontent.com/u/22693486?v=4)](https://github.com/filipefernandes9747 "filipefernandes9747 (1 commits)")

---

Tags

phpdoctypelaravelcoveragepackage

###  Code Quality

TestsPest

Static AnalysisRector

### Embed Badge

![Health badge](/badges/filipefernandes-laravel-type-coverage/health.svg)

```
[![Health](https://phpackages.com/badges/filipefernandes-laravel-type-coverage/health.svg)](https://phpackages.com/packages/filipefernandes-laravel-type-coverage)
```

###  Alternatives

[hotmeteor/spectator

Testing helpers for your OpenAPI spec

3021.4M1](/packages/hotmeteor-spectator)[nunomaduro/laravel-mojito

A lightweight package for testing Laravel views.

368435.5k11](/packages/nunomaduro-laravel-mojito)[guanguans/laravel-soar

SQL optimizer and rewriter for laravel. - laravel 的 SQL 优化器和重写器。

2227.8k](/packages/guanguans-laravel-soar)[calebdw/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

1484.6k3](/packages/calebdw-larastan)[yzen.dev/laravel-route-coverage

Laravel route coverage

213.8k](/packages/yzendev-laravel-route-coverage)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
