PHPGit
A Git wrapper for PHP5.3+
Install / Use
/learn @kzykhys/PHPGitREADME
PHPGit - A Git wrapper for PHP5.3+
Requirements
- PHP5.3
- Git
Installation
Update your composer.json and run composer update
{
"require": {
"kzykhys/git": "dev-master"
}
}
Basic Usage
<?php
require __DIR__ . '/vendor/autoload.php';
$git = new PHPGit\Git();
$git->clone('https://github.com/kzykhys/PHPGit.git', '/path/to/repo');
$git->setRepository('/path/to/repo');
$git->remote->add('production', 'git://example.com/your/repo.git');
$git->add('README.md');
$git->commit('Adds README.md');
$git->checkout('release');
$git->merge('master');
$git->push();
$git->push('production', 'release');
$git->tag->create('v1.0.1', 'release');
foreach ($git->tree('release') as $object) {
if ($object['type'] == 'blob') {
echo $git->show($object['file']);
}
}
API
Git commands
- git add
- $git->add(string|array|\Traversable $file, array $options = [])
- git archive
- $git->archive(string $file, string $tree = null, string|array|\Traversable $path = null, array $options = [])
- git branch
- git cat-file
- git checkout
- git clone
- $git->clone(string $repository, string $path = null, array $options = [])
- git commit
- $git->commit(string $message, array $options = [])
- git config
- git describe
- git fetch
- git init
- $git->init(string $path, array $options = [])
- git log
- $git->log(string $revRange = '', string $path = null, array $options = [])
- git merge
- git mv
- $git->mv(string|array|\Iterator $source, string $destination, array $options = [])
- git pull
- $git->pull(string $repository = null, string $refspec = null, array $options = [])
- git push
- $git->push(string $repository = null, string $refspec = null, array $options = [])
- git rebase
- git remote
- $git->remote()
- $git->remote->add(string $name, string $url, array $options = [])
- $git->remote->rename(string $name, string $newName)
- $git->remote->rm(string $name)
- $git->remote->show(string $name)
- $git->remote->prune(string $name = null)
- $git->remote->head(string $name, string $branch = null)
- $git->remote->head->set(string $name, string $branch)
- $git->remote->head->delete(string $name)
- $git->remote->head->remote(string $name)
- $git->remote->branches(string $name, array $branches)
- $git->remote->branches->set(string $name, array $branches)
- $git->remote->branches->add(string $name, array $branches)
- $git->remote->url(string $name, string $newUrl, string $oldUrl = null, array $options = [])
- $git->remote->url->set(string $name, string $newUrl, string $oldUrl = null, array $options = [])
- $git->remote->url->add(string $name, string $newUrl, array $options = [])
- $git->remote->url->delete(string $name, string $url, array $options = [])
- git reset
- $git->reset(string|array|\Traversable $paths, string $commit = null)
- $git->reset->soft(string $commit = null)
- $git->reset->mixed(string $commit = null)
- $git->reset->hard(string $commit = null)
- $git->reset->merge(string $commit = null)
- $git->reset->keep(string $commit = null)
- $git->reset->mode(string $mode, string $commit = null)
- git rm
- git shortlog
- git show
- $git->show(string $object, array $options = [])
- git stash
- $git->stash()
- $git->stash->save(string $message = null, array $options = [])
- $git->stash->lists(array $options = [])
- $git->stash->show(string $stash = null)
- $git->stash->drop(string $stash = null)
- $git->stash->pop(string $stash = null, array $options = [])
- $git->stash->apply(string $stash = null, array $options = [])
- $git->stash->branch(string $name
Related Skills
node-connect
347.6kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.6kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.6kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。




