PHPackages                             o0h/ast-check-diff - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. o0h/ast-check-diff

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

o0h/ast-check-diff
==================

AST-based PHP source diff checker

v2.0.0(1y ago)6221MITPHPPHP ~8.3.0CI passing

Since Dec 24Pushed 2w ago1 watchersCompare

[ Source](https://github.com/o0h/php-ast-check-diff)[ Packagist](https://packagist.org/packages/o0h/ast-check-diff)[ RSS](/packages/o0h-ast-check-diff/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (7)Versions (15)Used By (0)

PHP AST Check Diff Tool
=======================

[](#php-ast-check-diff-tool)

[![phpunit](https://github.com/o0h/php-ast-check-diff/actions/workflows/phpunit.yml/badge.svg)](https://github.com/o0h/php-ast-check-diff/actions/workflows/phpunit.yml)[![codecov](https://camo.githubusercontent.com/162a838d082b9d18a2cfc6f81150676de8bd96a9d2d7c810f04b1372c8b27a50/68747470733a2f2f636f6465636f762e696f2f67682f6f30682f7068702d6173742d636865636b2d646966662f67726170682f62616467652e7376673f746f6b656e3d68787442366c776d4b35)](https://codecov.io/gh/o0h/php-ast-check-diff)

Overview
--------

[](#overview)

The PHP AST Check Diff Tool is a powerful tool tailored for enhancing and refactoring PHP applications. This tool differentiates itself by analyzing PHP code through its Abstract Syntax Tree (AST), enabling more in-depth and meaningful code comparisons.

### Key Features

[](#key-features)

- **AST-based Diff**: Interprets PHP code as an Abstract Syntax Tree (AST) to detect nuanced differences beyond standard code-level diffs.
- **Git Integration**: Seamlessly works with Git to detect changes in PHP files, focusing on AST differences for a more comprehensive analysis.
- **Markdown Output**: Generates results in GitHub Flavored Markdown, providing clear and readable reports.

### User Benefits

[](#user-benefits)

- **Automated Reviews**: By focusing on AST differences, this tool automates the review process, making it less tedious and more efficient.
- **Safe Refactoring**: Facilitates safe code modifications. The tool ensures that code changes do not alter the intended behavior, thus supporting secure and reliable refactoring.

Appendix(thanks!)
-----------------

[](#appendixthanks)

Inspiration: The development of this tool was inspired by articles from :

- [MonotaRO Tech Blog](https://tech-blog.monotaro.com/entry/2018/09/26/142451)
- [Qiita(tetsunosukeito-san)](https://qiita.com/tetsunosukeito/items/c0e99a120414de226480)

Usage
-----

[](#usage)

To use the PHP AST Check Diff Tool, follow these steps:

1. Installation:
    - Run `composer require --dev o0h/ast-check-diff` to install the tool.
2. Execution:
    - Execute `vendor/bin/ast-check-diff check` to perform a comparison and output a Markdown document to standard output.
    - The `--head` and `--base` options can be passed via CLI to specify the source and destination of the comparison. Branch names, tags, or commit hashes can be used for this purpose.
3. Integration with GitHub Actions:
    - Integrating this tool with GitHub Actions for deep collaboration with pull requests is highly recommended.
        - Example code of workflow: [GitHub Workflow](https://github.com/o0h/php-ast-check-diff/blob/main/.github/workflows/php-ast-check-diff.yml)
        - Example of operation: [GitHub Pull Request Example](https://github.com/o0h/php-ast-check-diff/pull/5#issuecomment-1867274471)

examples:

- `vendor/bin/ast-check-diff check ast-diff-check` : If the `--head` option is omitted, `HEAD` is implicitly specified, and if the `--base` option is omitted, the `main` branch is implicitly specified.
- `vendor/bin/ast-check-diff check ast-diff-check --base HEAD@{3} --head HEAD~` : These comparisons are made by specifying pointers.
- `vendor/bin/ast-check-diff check ast-diff-check --base cd2f816 --head 1a89b0c` : These comparisons are made by specifying specific commits.

Notes
-----

[](#notes)

- This tool is intended for use with the latest PHP environments(8.3).
- Includes composer.lock: The project includes a composer.lock file.

Due to the above points, it is recommended to use this tool in isolated environments such as containers or on Continuous Integration (CI) platforms, rather than directly requiring it in your project.

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance69

Regular maintenance activity

Popularity13

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 59.9% 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 ~256 days

Total

2

Last Release

666d ago

Major Versions

v1.0.0 → v2.0.02024-09-05

PHP version history (2 changes)v1.0.0PHP &gt;8.2

v2.0.0PHP ~8.3.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/907122?v=4)[Hideki Kinjyo](/maintainers/o0h)[@o0h](https://github.com/o0h)

---

Top Contributors

[![o0h](https://avatars.githubusercontent.com/u/907122?v=4)](https://github.com/o0h "o0h (133 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (89 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/o0h-ast-check-diff/health.svg)

```
[![Health](https://phpackages.com/badges/o0h-ast-check-diff/health.svg)](https://phpackages.com/packages/o0h-ast-check-diff)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[brianhenryie/strauss

Prefixes dependencies namespaces so they are unique to your plugin

190438.1k36](/packages/brianhenryie-strauss)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

103519.9k53](/packages/friendsoftypo3-content-blocks)[aeliot/todo-registrar

Register TODOs from source code in issue tracker

153.0k](/packages/aeliot-todo-registrar)

PHPackages © 2026

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