jesse-bos/openai-commit-messages
Composer 安装命令:
composer require jesse-bos/openai-commit-messages
包简介
A Laravel package that generates AI-powered commit messages using OpenAI
README 文档
README
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
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
php artisan vendor:publish --provider="OpenAI\Laravel\ServiceProvider"
Step 3: Add your OpenAI API Key
- Get an API key from OpenAI's website
- Add it to your
.envfile:
OPENAI_API_KEY=sk-your-actual-api-key-here
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
- PHP 8.3+
- Laravel 11.0+ or 12.0+
- OpenAI API key with sufficient credits
Usage
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
After making changes in your git repository, simply run:
php artisan openai:commit-message
The package will automatically:
- First check for staged changes (files added with
git addor staged via Tower, GitHub Desktop, etc.) - If no staged changes found, it will analyze unstaged changes
- Generate a commit message based on the found changes using OpenAI
The tool works seamlessly with any git workflow:
- Command line:
git add .thenphp 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-messageto see a message for unstaged changes
After getting the suggested message, create your commit:
git commit -m "the suggested message"
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
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
You can also configure the OpenAI model using an environment variable:
OPENAI_COMMIT_MESSAGES_MODEL=gpt-4o
Testing
composer test
Credits
License
The MIT License (MIT). Please see License File for more information.
jesse-bos/openai-commit-messages 适用场景与选型建议
jesse-bos/openai-commit-messages 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 34 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 05 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「git」 「laravel」 「commit」 「ai」 「openai」 「Jesse Bos」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jesse-bos/openai-commit-messages 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jesse-bos/openai-commit-messages 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jesse-bos/openai-commit-messages 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Easily manage git hooks in your composer config
MediaWiki extension that allows embedding external content, specified by URL, into your wiki pages
Nagios plugin to verify a git repository.
A Laravel queue connector to process jobs after successful transactions commits
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.
Conventional commit for php
统计信息
- 总下载量: 34
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-25