1. Go to this page and download the library: Download autoframe/git-exec-hook 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/ */
autoframe / git-exec-hook example snippets
define('X_HUB_SIGNATURE','sha1 hook token'); //or use in AfrGitHook constructor
define('X_HUB_SIGNATURE_256','sha256 hook token'); //or use sha 256
define('X_PATH_TO_GIT_REPO_DIR','path to current repo dir'); //or use in AfrGitExec constructor
`AfrGitHook`
use Autoframe\GitExecHook\AfrGitHook;
use Autoframe\GitExecHook\AfrGitExec;
//Hook example
$oGhr = new AfrGitHook('HOOK_TOKEN', '', true);
$gitExec = new AfrGitExec(__DIR__ . '/origin');
//print_r($gitExec->setGitConfigDefault('autoframe','[email protected]'));
//print_r($gitExec->gitCloneWithUserToken('https://github.com/autoframe/hx','USER','ghp_TOKEN'));
if ($oGhr->isPushOnMasterBranch()) {
$aLog = $gitExec->allInOnePushCurrentThenSwitchToMasterPullAddCommitAndPush();
echo '<pre>';
print_r($aLog);
echo '</pre>';
}