PHP code example of tharlesamaro / laravel-git-ai

1. Go to this page and download the library: Download tharlesamaro/laravel-git-ai library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tharlesamaro / laravel-git-ai example snippets


return [

    // AI provider: 'anthropic', 'openai', or 'claude-code'
    'provider' => env('GIT_AI_PROVIDER', 'anthropic'),

    // AI model override (null = provider default)
    // Examples: 'claude-sonnet-4-5-20250929', 'gpt-4o', etc.
    'model' => env('GIT_AI_MODEL'),

    // Language for commit messages and changelog entries
    // Supported: 'en', 'pt-BR', 'es', 'fr', 'de', 'it', 'ja', 'ko', 'zh'
    'language' => env('GIT_AI_LANGUAGE', 'en'),

    // Allowed commit scopes (empty array = any scope allowed)
    // The AI will only use scopes from this list
    // Example: ['auth', 'api', 'ui', 'database', 'config']
    'scopes' => [],

    // Allowed commit types (empty array = all Conventional Commits types allowed)
    // The AI will only use types from this list
    // Example: ['feat', 'fix', 'docs', 'refactor', 'test']
    'types' => [],

    // Maximum diff size sent to the AI (in characters)
    // Diffs larger than this are truncated with a warning
    'max_diff_size' => env('GIT_AI_MAX_DIFF_SIZE', 15000),

    // Commit message settings
    'commit' => [

        // Body behavior: 'auto' (AI decides), 'always' (AI must    //         'lines' => ['Signed-off-by: Team <[email protected]>'],
            //     ],
            // ],
        ],
    ],

    // Changelog generation settings
    'changelog' => [

        // File path relative to project root
        'path' => 'CHANGELOG.md',

        // Include emojis in section titles (e.g., "### ✨ Features")
        'with_emojis' => true,
    ],

    // Git hook settings
    'hook' => [

        // Whether the commit-msg validation hook is enabled
        'enabled' => false,

        // When true, rejects non-conventional commits
        // When false, only displays a warning
        'strict' => true,
    ],

];

'templates' => [
    'default' => 'minimal',
],

'templates' => [
    'default' => null,
    'presets' => [
        'my-team' => [
            'body' => 'always',
            'footer' => [
                'breaking_change' => true,
                'co_authored_by' => false,
                'lines' => ['Signed-off-by: Team <[email protected]>'],
            ],
        ],
        'quick' => [
            'body' => 'never',
            'footer' => [
                'breaking_change' => false,
                'lines' => [],
            ],
        ],
    ],
],

// config/git-ai.php
'commit' => [
    'footer' => [
        'co_authored_by' => true,
    ],
],
bash
php artisan vendor:publish --tag=git-ai-config
bash
php artisan git:setup
bash
php artisan git:commit
bash
php artisan git:changelog
bash
php artisan git:setup
bash
php artisan git:commit --template=my-team