Download the PHP package sebastianfeldmann/git without Composer
On this page you can find all versions of the php package sebastianfeldmann/git. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sebastianfeldmann/git
More information about sebastianfeldmann/git
Files in sebastianfeldmann/git
Package git
Short Description PHP git wrapper
License MIT
Homepage https://github.com/sebastianfeldmann/git
Informations about the package git
git - a handy git wrapper
This lib is used to execute git
commands directly from PHP via a defined api.
All you have to do is setup a Repository
object, retrieve a command Operator
and fire away. Each git command like git config or git log is handled
by a separate Operator
. Follow the next steps to give it a try.
Installation
The git package is installable via composer. Just run the following command.
Usage
Setup the Repository
Retrieve the needed Operator
Get files and commits since some tag
Copy Paste Example
Available operators
- Config - Access all git settings e.g. line break settings.
- Diff - Compare two versions.
- Index - Check the staging area.
- Info - Access the current state like branch name or commit hash.
- Log - Returns list of changed files and other git log information.
Example commands
Get the current tag:
// git describe --tag
$tag = $infoOperator->getCurrentTag();
Get tags for a given commit:
// git tag --points-at HEAD
$tags = $infoOperator->getTagsPointingTo('HEAD');
Get the current branch:
// git rev-parse --abbrev-ref HEAD
$branch = $infoOperator->getCurrentBranch();
Get a list of staged files:
// git diff-index --cached --name-status HEAD
$files = $indexOperator->getStagedFiles();
Get all current git settings:
// git config --list
$config = $configOperator->getSettings();
Get all changed files since a given commit or tag:
// git log --format='' --name-only $HASH
$files = $logOperator->changedFilesSince('1.0.0');
Get differences between two versions
// git diff '1.0.0' '1.1.0'
$changes = $diffOperator->compare('1.0.0', '1.1.0');
All versions of git with dependencies
ext-json Version *
ext-libxml Version *
ext-simplexml Version *
sebastianfeldmann/cli Version ^3.0