Download the PHP package tharlesamaro/laravel-git-ai without Composer

On this page you can find all versions of the php package tharlesamaro/laravel-git-ai. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-git-ai

Laravel Git AI

Latest Version on Packagist Total Downloads

English | Portugues

AI-powered Git workflow automation for Laravel. Generate smart commit messages, changelogs, and validate commits using Conventional Commits.

Why use this package instead of Claude Code directly?

If you already use Claude Code CLI, you might wonder: "Why not just ask Claude to commit for me?" Here's what this package brings to the table:

Feature Claude Code alone Laravel Git AI
Conventional Commits format You have to ask every time Enforced automatically via structured output
Consistent JSON schema Free-form text, may vary Validated against a strict schema every time
Project-specific scopes Must remember to mention them Configured once, enforced on every commit
Allowed commit types Manual discipline Restricted by config, AI cannot use others
Multi-language support Must specify in every prompt Configured once, always applied
Changelog generation Manual work Automated from commit history between tags
Git hook validation Not available Optional hook rejects non-conventional commits
Team consistency Each developer prompts differently Same rules for everyone via shared config
Max diff size control No control, may exceed context Auto-truncated to configured limit
Works without CLI installed N/A Falls back to API providers (Anthropic/OpenAI)

In short: this package turns AI-generated commits into a repeatable, team-wide standard instead of a one-off prompt.

Features

Requirements

Installation

Publish the configuration file:

Run the interactive setup:

Provider Setup

Option 1: Anthropic API (default)

Option 2: OpenAI API

Option 3: Claude Code CLI (no API key)

If you have a Claude subscription (e.g. Max plan) and the Claude Code CLI installed, you can use it directly without any API key:

Make sure the claude binary is available in your PATH. Install it from: https://docs.anthropic.com/en/docs/claude-code

This option invokes the Claude Code CLI as a subprocess, passing a structured prompt and parsing the JSON response. It consumes from your existing subscription usage -- no separate API tokens needed.

Usage

git:commit -- Generate a commit message

Stage your changes and run:

Or stage everything automatically with the --all (-a) flag:

Available options:

Option Short Description
--all -a Stage all changes before committing
--template= Use a named commit template (e.g. minimal, detailed)
--no-body Strip body from the commit message
--footer= Add custom footer line(s) (can be used multiple times)

What happens:

  1. Reads your staged diff (truncated if it exceeds max_diff_size)
  2. Sends it to the configured AI provider
  3. Receives a structured response with type, scope, description, body, and is_breaking_change
  4. Validates the type and scope against your config
  5. Formats the message following Conventional Commits
  6. Lets you choose what to do next

Interactive menu:

Example with body and breaking change:

git:changelog -- Generate a changelog

Available options:

Option Description Default
--from= Starting tag or commit hash Latest tag (or first commit if no tags)
--to= Ending tag or commit hash HEAD
--tag= Version tag for the changelog header Interactive prompt
--dry-run Preview without writing to file false

Examples:

What happens:

  1. Resolves the starting reference (priority: --from > latest tag > first commit)
  2. Gets all commits between from and to
  3. Parses each commit message using the Conventional Commits format
  4. Groups commits by type (feat, fix, docs, etc.)
  5. Sends the grouped commits to the AI for human-readable descriptions
  6. Formats the output as Markdown with emojis (configurable)
  7. Shows a preview and asks for confirmation before writing

Output example (CHANGELOG.md):

If changelog.with_emojis is enabled (default), section titles include emojis:

The changelog is prepended to the existing file. If CHANGELOG.md already exists, new content is added at the top (below the header), preserving previous entries.

git:setup -- Interactive configuration

The wizard walks you through every configurable option:

  1. AI provider -- Anthropic API, OpenAI API, or Claude Code CLI
  2. Language -- English, Portuguese (Brazil), Spanish, French, German, Italian, Japanese, Korean, or Chinese
  3. Scopes -- Define allowed scopes for your project (e.g., auth, api, ui, database)
  4. Types -- Restrict which commit types are allowed (e.g., only feat, fix, docs)
  5. Body preference -- How the AI handles commit message body (auto, always, never)
  6. Git hook -- Install a commit-msg hook that rejects non-conventional commits

After setup, it writes config/git-ai.php and shows the environment variables you need to add to .env.

Configuration

All options in config/git-ai.php:

Environment variables

Variable Description Default
GIT_AI_PROVIDER AI provider (anthropic, openai, claude-code) anthropic
GIT_AI_MODEL AI model override Provider default
GIT_AI_LANGUAGE Commit message language en
GIT_AI_MAX_DIFF_SIZE Max diff size in characters 15000
GIT_AI_COMMIT_BODY Body behavior (auto, always, never) auto
GIT_AI_CO_AUTHORED_BY Include Co-Authored-By trailer false
GIT_AI_TEMPLATE Default commit template name --
ANTHROPIC_API_KEY Anthropic API key (when provider is anthropic) --
OPENAI_API_KEY OpenAI API key (when provider is openai) --

Commit Templates

Templates bundle body and footer preferences into named presets. They're entirely optional -- without a template, the commit config section is used directly.

Built-in templates

Template Body BREAKING CHANGE footer Use case
minimal Never No Quick, one-line commits
detailed Always Yes Thorough commits with full context

Using templates

Set a default template

In your .env:

Or in config/git-ai.php:

Custom templates

Define your own presets in config/git-ai.php:

Then use it:

Disabling Co-Authored-By

By default, the Co-Authored-By trailer is not included in commit messages. If you want to enable it:

Or via environment variable:

When enabled, commits will include a trailer like:

Set it to false (default) to keep commits clean without AI attribution.

Git Hook

The package includes an optional commit-msg git hook that validates commit messages against the Conventional Commits specification.

What it validates:

Install the hook:

Example of a rejected commit:

Conventional Commits

This package follows the Conventional Commits v1.0.0 specification:

Supported types

Type Emoji Description
feat โœจ A new feature
fix ๐Ÿ› A bug fix
docs ๐Ÿ“š Documentation only changes
style ๐Ÿ’Ž Code style changes (formatting, semicolons, etc.)
refactor โ™ป๏ธ Code refactoring (no feature or fix)
perf โšก Performance improvements
test ๐Ÿงช Adding or fixing tests
build ๐Ÿ“ฆ Build system or dependency changes
ci ๐Ÿ”ง CI configuration changes
chore ๐Ÿ”จ Other changes (tooling, configs, etc.)
revert โช Reverts a previous commit

Breaking changes

Breaking changes are indicated by:

The AI detects breaking changes automatically from the diff and sets is_breaking_change accordingly.

Architecture

The package uses a service abstraction layer (AiService contract) that allows swapping between providers without changing command logic:

The provider is resolved at runtime based on config('git-ai.provider'). Both implementations return the same structured array format, ensuring consistent behavior regardless of the provider.

Testing

This package uses Pest PHP for testing. To run with coverage:

Using Docker:

Contributing

Contributions are welcome! Please follow Conventional Commits for your commit messages.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feat/amazing-feature)
  3. Commit your changes (php artisan git:commit ๐Ÿ˜„)
  4. Push to the branch (git push origin feat/amazing-feature)
  5. Open a Pull Request

License

The MIT License (MIT). See LICENSE for details.


All versions of laravel-git-ai with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
laravel/framework Version ^12.0
laravel/ai Version ^0.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tharlesamaro/laravel-git-ai contains the following files

Loading the files please wait ...