1. Go to this page and download the library: Download antogno/gitinfo 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/ */
antogno / gitinfo example snippets
use antogno\GitInfo\GitInfo;
$GitInfo = new GitInfo();
$GitInfo->getGitVersion();
// For example: string(6) "2.40.0"
use antogno\GitInfo\Resources\AuthorResource;
$Author = new AuthorResource('[email protected]', 'antogno');
$Author = new AuthorResource('', 'antogno');
$Author = new AuthorResource('[email protected]');
$Author->getName();
// For example: string(7) "antogno"
use antogno\GitInfo\Resources\CommitResource;
$Commit = new CommitResource('ed8f9325485f108ddafe3890dc4b13be07aa13cb');
$Commit = new CommitResource('ed8f932');
$Commit->getLongHash();
// For example: string(40) "ed8f9325485f108ddafe3890dc4b13be07aa13cb"
$Commit->getShortHash();
// For example: string(7) "ed8f932"
$Commit->getMessage();
// For example: string(14) "Initial commit"
$Commit->getDate();
$Commit->getAuthor();
$GitInfo->hasTag('v1.0.0');
// For example: bool(true)
$GitInfo->hasTag('V1.0.0');
// For example: bool(false)
$GitInfo->getCurrentTag();
$GitInfo->getTag('v1.0.0');
$GitInfo->getTags();
use antogno\GitInfo\Resources\TagResource;
$Tag = new TagResource('v1.0.0');
$Tag->getName();
// For example: string(6) "v1.0.0"
$Tag->getLastCommit();
$GitInfo->hasRemote('origin');
// For example: bool(true)
$GitInfo->hasRemote('ORIGIN');
// For example: bool(false)
$GitInfo->getCurrentRemote();
$GitInfo->getRemote('origin');
$GitInfo->getRemotes();
use antogno\GitInfo\Resources\RemoteResource;
$Remote = new RemoteResource('origin');
$Remote->getName();
// For example: string(6) "origin"
$Remote->getUrl();
// For example: string(38) "https://github.com/antogno/gitinfo.git"
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.