PHPackages                             acseo/ai-phpunit - 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. acseo/ai-phpunit

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

acseo/ai-phpunit
================

Writes missing PHPUnit tests using GPT-4.

141[1 PRs](https://github.com/acseo/ai-phpunit/pulls)PHPCI passing

Since Aug 17Pushed 1y ago3 watchersCompare

[ Source](https://github.com/acseo/ai-phpunit)[ Packagist](https://packagist.org/packages/acseo/ai-phpunit)[ RSS](/packages/acseo-ai-phpunit/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

AI PHPUnit
==========

[](#ai-phpunit)

AI PHPUnit is a tool that uses GPT-4 to automatically add missing PHPUnit tests to your PHP code.

Prerequisites
-------------

[](#prerequisites)

This package uses the OpenAI API. Before using AI PHPUnit, you will need to have an OpenAI API key set as an environment variable.

```
export OPENAI_KEY=...
```

Installation
------------

[](#installation)

To install AI PHPUnit, run the following command:

```
composer global require acseo/ai-phpunit
```

Usage
-----

[](#usage)

To add missing PHPUnit comments to a single file, use the following command:

```
aiphpunit file  /path/to/file.php
```

To add missing PHPUnit tests to a directory of files, use the following command. By default it iterates through the current directory for all files, but does not go into subdirectories:

```
aiphpunit dir
```

You may set the `--recursive` flag, or `-r` for short for it to go into subdirectories.

If you pass another variable (regardless of the recursive flag) it will treat it as another directory to sweep through instead of the working directory.

```
aiphpunit dir -r /somewhere/else
```

### Docker usage

[](#docker-usage)

You can use the Docker image acseo/ai-phpunit to use ai-phpunit via docker

```
$ docker run -it -e OPENAI_KEY=sk-xxx -v /path/to/your/code:/code acseo/ai-phpunit dir -r /code/src
```

License
-------

[](#license)

AI PHPUnit is licensed under the AGPL-3.0 license. See LICENSE for more information.

It is inspired by [ai-phpdoc](https://github.com/molbal/ai-phpdoc)

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity19

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a21f9d389ad9d714e1e84226a4b2def0417c9bfec60ea43c22104a8e93a654da?d=identicon)[npotier](/maintainers/npotier)

---

Top Contributors

[![npotier](https://avatars.githubusercontent.com/u/1151094?v=4)](https://github.com/npotier "npotier (3 commits)")

### Embed Badge

![Health badge](/badges/acseo-ai-phpunit/health.svg)

```
[![Health](https://phpackages.com/badges/acseo-ai-phpunit/health.svg)](https://phpackages.com/packages/acseo-ai-phpunit)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)

PHPackages © 2026

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