PHP code example of atelierspierrot / git-api

1. Go to this page and download the library: Download atelierspierrot/git-api 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/ */

    

atelierspierrot / git-api example snippets


// open a repo
$local_repo = ~/repositories/git-api
$repo = \GitApi\GitApi::open($local_repo)

// commiters list
$repo->getCommitersList()

// branches list
$repo->getBranchesList()

// commits list
$repo->getCommitsList()

// current branch
$repo->getCurrentBranch()

// description
$repo->getDescription()

// tags list
$repo->getTagsList()

// last commit infos
$repo->getLastCommitInfos()

// tree
$repo->getTree()

// tree for first dir
$repo->getTree('HEAD', $first_dir)

// files info
$repo->getFilesInfo()

// recursive tree
$repo->getRecursiveTree()

// commits history
$repo->getCommitsHistory()

// create a clone of a distant repo in a local dir
// if the local clone already exists, a `git pull` will be processed on it
$distant_repo = https://github.com/atelierspierrot/git-api
$local_repo = ~/repositories/git-api
$repo = \GitApi\GitApi::create($local_repo, $distant_repo)

// ... same as above