Skip to content
/ git-dl Public

Clones a Github repository with PHP & ZipArchive. Without using Git or exec().

License

Notifications You must be signed in to change notification settings

drhino/git-dl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Download a Github repository with PHP.

Install with composer:

$ composer require wbadrh/git-dl

Example usage:

<?php

$git = new GitDownload('/your/downloads');

$author     = 'drhino';
$repository = 'git-dl';
$branch     = 'master';

$path = $git->clone($author, $repository, $branch);

// Prints: 'Saved to: /your/downloads/drhino/git-dl'
echo "Saved to: $path";

How does it work?

The zip-archive is downloaded from Github. Then unpacked with ZipArchive.
From version 1.1.x and above; A stream is used to keep a low memory footprint.
After a succesful unpack, the downloaded archive is removed.
Cloning an existing repository updates to the latest version.

Changelog:

v1.1.0

  • Uses a stream for writing.
  • The PHP cURL extension is no longer used.
  • Supports both Flysystem 1 and 3 (PHP 7 and 8).
  • Returns the directory path on success.
  • Throws Exception.

v1.0.2

  • Fixes CVE-2021-32708.

v1.0.1

  • Adds documentation.

v1.0.0

  • Initial release.

About

Clones a Github repository with PHP & ZipArchive. Without using Git or exec().

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published