1. Go to this page and download the library: Download pvpender/git-kphp 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/ */
pvpender / git-kphp example snippets
use pvpender\GitKphp\Systemc;
Systemc::load();
use pvpender\GitKphp\Git;
use pvpender\GitKphp\Systemc;
Systemc::load();
$git = new pvpender\GitKphp\Git;
// create repo object
$repo = $git->open(__DIR__);
// or you can just clone repo
// $repo = $git->cloneRepository('https://github.com/user/repo');
// create a new file in repo
$filename = $repo->getRepositoryPath() . '/newfile.txt';
file_put_contents($filename, "Hello world!");
// commit
$repo->addFile($filename);
$repo->commit('init commit');