PHP wrapper for Git commands.

Maintainers

Package info

github.com/ghostwriter/git

pkg:composer/ghostwriter/git

Fund package maintenance!

ghostwriter

Statistics

Installs: 89 577

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.3 2026-01-26 01:48 UTC

README

GitHub Sponsors Automation Supported PHP Version Downloads

PHP wrapper for Git commands

Installation

You can install the package via composer:

composer require ghostwriter/git

Star ⭐️ this repo if you find it useful

You can also star (🌟) this repo to find it easier later.

Usage

use Ghostwriter\Git\Git;

$environmentVariables = [
    'GIT_AUTHOR_NAME'  => 'Nathanael Esayeas',
    'GIT_AUTHOR_EMAIL' => 'nathanael.esayeas@protonmail.com',
];

$git = Git::new('/path/to/repo', $environmentVariables);
$git->init();
$git->add('file.txt');
$git->commit('-m', 'Initial commit');
$git->push('origin', 'main');

// Cloning a repository
$git->clone('git@github.com:ghostwriter/git.git', '--depth=1', '/path/to/clone');

// Each cloned repository should be managed with its own Git instance as follows:
$environmentVariables['GIT_AUTHOR_NAME'] = 'ghostwriter';
$environmentVariables['GIT_AUTHOR_EMAIL'] = 'ghostwriter@users.noreply.github.com';

$clonedGit = Git::new('/path/to/clone', $environmentVariables);
$clonedGit->status();

Credits

Changelog

Please see CHANGELOG.md for more information on what has changed recently.

License

Please see LICENSE for more information on the license that applies to this project.

Security

Please see SECURITY.md for more information on security disclosure process.