-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from drhino/dev
Merges v1.1.0 into master
- Loading branch information
Showing
9 changed files
with
172 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.236.0/containers/ubuntu/.devcontainer/base.Dockerfile | ||
|
||
# [Choice] Ubuntu version (use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon): ubuntu-22.04, ubuntu-20.04, ubuntu-18.04 | ||
# Release: 20.04 | ||
# Codename: focal | ||
# Description: Ubuntu 20.04.4 LTS | ||
ARG VARIANT="jammy" | ||
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT} | ||
|
||
# | ||
# PHP 7.4(.3) | ||
# | ||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get -y install --no-install-recommends php7.4 php7.4-zip | ||
|
||
# | ||
# PHP 8.0(.20) | ||
# | ||
#RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
# && apt-get -y install --no-install-recommends software-properties-common \ | ||
# && add-apt-repository -y ppa:ondrej/php \ | ||
# && apt-get -y install --no-install-recommends php8.0 php8.0-zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: | ||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.236.0/containers/ubuntu | ||
{ | ||
"name": "Ubuntu", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
// Update 'VARIANT' to pick an Ubuntu version: jammy / ubuntu-22.04, focal / ubuntu-20.04, bionic /ubuntu-18.04 | ||
// Use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon. | ||
"args": { "VARIANT": "ubuntu-20.04" } | ||
}, | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "uname -a", | ||
"postCreateCommand": "php -r \"copy('https://getcomposer.org/installer', 'composer-setup.php');\" && php -r \"if (hash_file('sha384', 'composer-setup.php') !== '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') unlink('composer-setup.php');\" && php composer-setup.php && php composer.phar install && rm composer-setup.php", | ||
|
||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. | ||
"remoteUser": "vscode", | ||
"features": { | ||
"git": "os-provided" | ||
}, | ||
"extensions": [ | ||
"eserozvataf.one-dark-pro-monokai-darker", | ||
"xdebug.php-debug" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
downloaded/ | ||
vendor/ | ||
*.lock | ||
composer.phar | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Launch currently open script", | ||
"type": "php", | ||
"request": "launch", | ||
"program": "${file}", | ||
"cwd": "${fileDirname}", | ||
"port": 0, | ||
"runtimeArgs": [ | ||
"-dxdebug.start_with_request=yes" | ||
], | ||
"env": { | ||
"XDEBUG_MODE": "debug,develop", | ||
"XDEBUG_CONFIG": "client_port=${port}" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,50 @@ | ||
# Download a Github repository with PHP. | ||
|
||
This script will download the requested zip-archive with CURL. | ||
Afterwards it will unpack with ZipArchive. | ||
|
||
The Github repository will be downloaded in: GithubAuthor/Repository/ | ||
### Install with composer: | ||
|
||
```sh | ||
$ composer require wbadrh/git-dl | ||
``` | ||
|
||
### Example usage: | ||
|
||
```php | ||
<?php | ||
|
||
$git = new GitDownload(__DIR__ . '/downloaded'); | ||
$git = new GitDownload('/your/downloads'); | ||
|
||
$author = 'wbadrh'; | ||
$author = 'drhino'; | ||
$repository = 'git-dl'; | ||
$branch = 'master'; | ||
|
||
$git->clone($author, $repository, $branch); | ||
$path = $git->clone($author, $repository, $branch); | ||
|
||
// Prints: 'Saved to: /your/downloads/drhino/git-dl' | ||
echo "Saved to: $path"; | ||
|
||
``` | ||
|
||
Would download in: downloaded/wbadrh/git-dl/ | ||
## How does it work? | ||
|
||
The zip-archive is downloaded from Github. Then unpacked with ZipArchive. | ||
<br>From version 1.1.x and above; A stream is used to keep a low memory footprint. | ||
<br>After a succesful unpack, the downloaded archive is removed. | ||
<br>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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters