Skip to content

adrianclay/php-git

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GIT

PHP Composer

Usage

First register your repository path against a hostname.

StreamWrapper::registerRepository( $pathToRepository, $hostname );

That hostname then refers to your local git repository, which can be used when constructing a URL to reference files within the repo.

$filePath = "git://branch@hostname/path/under/version/control";

Example extracting all files within the src folder pointed to by the main branch:

use adrianclay\git\StreamWrapper;
StreamWrapper::registerRepository( $phpGitRepo, 'adrianclay.php-git' );
var_dump( scandir( 'git://main@adrianclay.php-git/src' ) );

array(9) {
  [0] =>
  string(10) "Commit.php"
  [1] =>
  string(8) "Head.php"
  [2] =>
  string(10) "Object.php"
  [3] =>
  string(14) "Repository.php"
  [4] =>
  string(7) "SHA.php"
  [5] =>
  string(16) "SHAReference.php"
  [6] =>
  string(17) "StreamWrapper.php"
  [7] =>
  string(4) "Tree"
  [8] =>
  string(8) "Tree.php"
}

Development

Prerequisites

$ composer install

$ composer exec phpunit

About

Parse git repositories in native PHP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages