{"id":22756554,"url":"https://github.com/ay4t/php-commit-generator","last_synced_at":"2025-10-28T13:06:53.564Z","repository":{"id":262882501,"uuid":"888656823","full_name":"ay4t/php-commit-generator","owner":"ay4t","description":"A PHP library that generates meaningful and standardized Git commit messages using AI powered by Groq API. This tool analyzes your git diff and generates commit messages that follow best practices and conventional commit standards.","archived":false,"fork":false,"pushed_at":"2025-06-26T05:15:58.000Z","size":43,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-26T06:25:29.276Z","etag":null,"topics":["ai","commit","commit-message","generator","groq-api","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ay4t.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-11-14T19:23:12.000Z","updated_at":"2025-06-26T05:16:01.000Z","dependencies_parsed_at":"2024-11-14T20:27:25.553Z","dependency_job_id":"55449201-bc1c-46eb-a100-623f448761a0","html_url":"https://github.com/ay4t/php-commit-generator","commit_stats":null,"previous_names":["ay4t/php-commit-generator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ay4t/php-commit-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ay4t%2Fphp-commit-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ay4t%2Fphp-commit-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ay4t%2Fphp-commit-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ay4t%2Fphp-commit-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ay4t","download_url":"https://codeload.github.com/ay4t/php-commit-generator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ay4t%2Fphp-commit-generator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271570261,"owners_count":24782588,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","commit","commit-message","generator","groq-api","php"],"created_at":"2024-12-11T07:14:15.302Z","updated_at":"2025-10-28T13:06:53.558Z","avatar_url":"https://github.com/ay4t.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Commit Generator\n\nA PHP library that generates meaningful and standardized Git commit messages using AI powered by Groq API. This tool analyzes your git diff and generates commit messages that follow best practices and conventional commit standards.\n\n## Features\n\n- AI-powered commit message generation\n- Follows conventional commit message standards\n- Analyzes git diff to understand code changes\n- Generates both commit titles and detailed descriptions\n- Easy integration with existing PHP projects\n- Title prefix support for issue tracking (e.g., ISSUE-123)\n- Commit history context via `git log` (10 commit terakhir)\n\n## Requirements\n\n- PHP 8.0 or higher\n- Composer\n- Groq API key\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require ay4t/php-commit-generator\n```\n\n## Usage\n\n### Basic Usage\nYou can use the library directly from your workspace using CLI command. But you need to provide GROQ API key first.\nExample:\n```bash\nEXPORT GROQ_API_KEY=your-groq-api-key\n```\n```bash\nphp /path/to/generate.php -d /path/to/directory\n```\nor if you working with current directory you can simply \n```bash\nphp /path/to/generate.php -d ./\n```\n\n### Using the Library\n\n```php\nuse Ay4t\\PCGG\\Commit;\n\n// Initialize with your Groq API key\n$commit = new Commit('your-groq-api-key');\n\n// Provide git diff\n$diff = shell_exec('git diff --staged');\n$commit-\u003egitDiff($diff);\n\n// Generate commit message\n$message = $commit-\u003egenerate();\necho $message;\n```\n\n### Using the CLI Script\n\nThe package includes a CLI script for easy usage:\n\n1. Set your Groq API key:\n```bash\nexport GROQ_API_KEY=your-groq-api-key\n```\n\n2. Run the generator:\n```bash\nphp generate.php\n```\n\n3. Additional options:\n```bash\n# Set working directory\nphp generate.php -d ./your-project-dir\n\n# Add a title prefix (e.g., issue number)\nphp generate.php --prefix=\"ISSUE-123\"\n# or short version\nphp generate.php -p \"ISSUE-123\"\n\n# Enable/disable commit history\nphp generate.php --enable-history=false\n# or short version\nphp generate.php -e false\n```\n\nThe script will automatically:\n- Get staged changes using `git diff --staged`\n- Generate an appropriate commit message\n- Output the message ready for use\n- (Optional) Include last 10 entries from `git log` as additional context when history is enabled\n\n## Generated Message Format\n\nThe generated commit messages follow this format:\n\n```\n\u003ctype\u003e(\u003cscope\u003e): \u003cshort summary\u003e\n\n\u003cdetailed description\u003e\n\n- Change 1 details\n- Change 2 details\n```\n\nWhere:\n- `type`: The type of change (feat, fix, docs, style, refactor, test, chore)\n- `scope`: The scope of changes (optional)\n- `summary`: A brief description of changes\n- `detailed description`: A more comprehensive explanation of the changes\n\n## Configuration\n\nThe commit message generator is configured to follow best practices:\n- Commit titles are limited to 50 characters\n- Descriptions are wrapped at 72 characters\n- Follows conventional commit format\n- Includes relevant context and reasoning\n\n## Error Handling\n\nThe library includes comprehensive error handling:\n\n```php\ntry {\n    $commit = new Commit($apiKey);\n    $commit-\u003egitDiff($diff);\n    $message = $commit-\u003egenerate();\n} catch (\\Exception $e) {\n    echo \"Error: \" . $e-\u003egetMessage();\n}\n```\n\n## Testing\n\nRun the test suite:\n\n```bash\ncomposer test\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## Credits\n\n- Author: Ayatulloh Ahad R\n- Powered by [Groq API](https://console.groq.com)\n\n## Support\n\nIf you encounter any problems or have suggestions, please [open an issue](https://github.com/ay4t/php-commit-generator/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fay4t%2Fphp-commit-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fay4t%2Fphp-commit-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fay4t%2Fphp-commit-generator/lists"}