PHPackages                             jesse-bos/openai-commit-messages - 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. jesse-bos/openai-commit-messages

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

jesse-bos/openai-commit-messages
================================

A Laravel package that generates AI-powered commit messages using OpenAI

v1.0.0(11mo ago)034[4 PRs](https://github.com/jesse-bos/openai-commit-messages/pulls)MITPHPPHP ^8.3CI passing

Since May 25Pushed 1mo agoCompare

[ Source](https://github.com/jesse-bos/openai-commit-messages)[ Packagist](https://packagist.org/packages/jesse-bos/openai-commit-messages)[ Docs](https://github.com/jesse-bos/openai-commit-messages)[ GitHub Sponsors]()[ RSS](/packages/jesse-bos-openai-commit-messages/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (13)Versions (6)Used By (0)

OpenAI Commit Messages - AI-Generated Git Commit Messages
=========================================================

[](#openai-commit-messages---ai-generated-git-commit-messages)

[![Latest Version on Packagist](https://camo.githubusercontent.com/34508e6b57584ee460b068dc681b7b8e49255a5e5c8d1bcd60d402d7f77cbb88/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a657373652d626f732f6f70656e61692d636f6d6d69742d6d657373616765732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jesse-bos/openai-commit-messages)[![GitHub Tests Action Status](https://camo.githubusercontent.com/b36e76c77858d8d2af4ea6e064454e4f4bfd778eb4e30c3057302727a3714d3e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a657373652d626f732f6f70656e61692d636f6d6d69742d6d657373616765732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/jesse-bos/openai-commit-messages/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/0390503285ad8fd8f5ce87d93c3dd6fe2ad08d7f0d75b208fee9f2e2624a65ea/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a657373652d626f732f6f70656e61692d636f6d6d69742d6d657373616765732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/jesse-bos/openai-commit-messages/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/92b319b6c1a775541903fe92b3971b6a97ede05b2167bd97d22742ebf4b5a492/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a657373652d626f732f6f70656e61692d636f6d6d69742d6d657373616765732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jesse-bos/openai-commit-messages)

OpenAI Commit Messages is a Laravel package that generates meaningful commit messages using OpenAI based on your git changes. It first checks for staged changes, and if none are found, analyzes unstaged changes. Just run one command and get a suggested commit message!

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

[](#installation)

### Step 1: Install the Package

[](#step-1-install-the-package)

```
composer require jesse-bos/openai-commit-messages --dev
```

*This automatically installs the required OpenAI Laravel package as well.*

### Step 2: Publish OpenAI Configuration

[](#step-2-publish-openai-configuration)

```
php artisan vendor:publish --provider="OpenAI\Laravel\ServiceProvider"
```

### Step 3: Add your OpenAI API Key

[](#step-3-add-your-openai-api-key)

1. Get an API key from [OpenAI's website](https://platform.openai.com/api-keys)
2. Add it to your `.env` file:

```
OPENAI_API_KEY=sk-your-actual-api-key-here
```

### Step 4: Optionally configure the Package

[](#step-4-optionally-configure-the-package)

If you want to customize the OpenAI model, publish the package config:

```
php artisan vendor:publish --tag="openai-commit-messages-config"
```

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

[](#prerequisites)

- PHP 8.3+
- Laravel 11.0+ or 12.0+
- OpenAI API key with sufficient credits

Usage
-----

[](#usage)

### Verify your setup (recommended first time)

[](#verify-your-setup-recommended-first-time)

After installation, verify that everything is configured correctly by running the command. The package will automatically check:

- ✓ OpenAI API key is set
- ✓ OpenAI configuration is published
- ✓ You're in a git repository
- ✓ Model configuration

### Generate commit messages

[](#generate-commit-messages)

After making changes in your git repository, simply run:

```
php artisan openai:commit-message
```

The package will automatically:

1. **First check for staged changes** (files added with `git add` or staged via Tower, GitHub Desktop, etc.)
2. **If no staged changes found**, it will analyze unstaged changes
3. **Generate a commit message** based on the found changes using OpenAI

The tool works seamlessly with any git workflow:

- **Command line**: `git add .` then `php artisan openai:commit-message`
- **Tower/GitHub Desktop**: Stage files in the GUI, then run `php artisan openai:commit-message`
- **Quick preview**: Just run `php artisan openai:commit-message` to see a message for unstaged changes

After getting the suggested message, create your commit:

```
git commit -m "the suggested message"
```

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

[](#configuration)

You can configure the package by publishing and editing the config file:

```
php artisan vendor:publish --tag="openai-commit-messages-config"
```

### Available Configuration Options

[](#available-configuration-options)

```
return [
    'openai' => [
        // OpenAI model to use for generating commit messages
        'model' => env('OPENAI_COMMIT_MESSAGES_MODEL', 'gpt-4o-mini'),
    ],

    'commit' => [
        // Maximum length for the commit message
        'max_length' => 72,

        // Use conventional commit format (e.g. feat: message, fix: bug)
        'conventional' => true,
    ],
];
```

### Environment Variables

[](#environment-variables)

You can also configure the OpenAI model using an environment variable:

```
OPENAI_COMMIT_MESSAGES_MODEL=gpt-4o
```

Testing
-------

[](#testing)

```
composer test
```

Credits
-------

[](#credits)

- [Jesse Bos](https://github.com/jesse-bos)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance72

Regular maintenance activity

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

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

Unknown

Total

1

Last Release

358d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/32f2646ab737965790eb5db5d8a06ffa70c9cf6e9e44b51bedc90cb55f20b5d8?d=identicon)[jesse-bos](/maintainers/jesse-bos)

---

Top Contributors

[![jesse-bos](https://avatars.githubusercontent.com/u/131663982?v=4)](https://github.com/jesse-bos "jesse-bos (36 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (8 commits)")

---

Tags

laravelaiopenaigitcommitJesse Bosopenai-commit-messages

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/jesse-bos-openai-commit-messages/health.svg)

```
[![Health](https://phpackages.com/badges/jesse-bos-openai-commit-messages/health.svg)](https://phpackages.com/packages/jesse-bos-openai-commit-messages)
```

###  Alternatives

[helgesverre/extractor

AI-Powered Data Extraction for your Laravel application.

22128.0k](/packages/helgesverre-extractor)[maestroerror/laragent

Power of AI Agents in your Laravel project

630106.4k](/packages/maestroerror-laragent)[salehhashemi/laravel-intelli-git

An intelligent Git helper package for Laravel applications. It utilizes OpenAI's GPT to analyze your Git repository, providing features such as automatic generation of commit messages based on staged changes.

131.5k](/packages/salehhashemi-laravel-intelli-git)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)

PHPackages © 2026

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