bhittani/download 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bhittani/download

Composer 安装命令:

composer require bhittani/download

包简介

Programmatically download files, zip archives and GitHub repositories.

README 文档

README

Programmatically download files, zip archives and GitHub repositories.

Requirements

  • PHP >= 5.6
  • PHP Zip Extension

Install

You may install this package using composer.

$ composer require bhittani/download --prefer-dist

Usage

This package currently allows downloading/extraction of files (local/network), zip files (local/network) and GitHub repositories.

Downloading a file

The file downloader allows downloading of a single file either from a local disk or over a network.

<?php
use Bhittani\Download\File;

// Create an instance of Bhittani\Download\File with the path to the source file.
$file = new File('path/to/a/local/or/www/file.ext');

// Download the file to a local destination.
$file->download('path/to/local/destination/file.ext');

Downloading/extracting a zip archive

The zip downloader allows downloading of a zip file either from a local disk or over a network and extracting its contents into a local folder.

<?php
use Bhittani\Download\Zip;

// Create an instance of Bhittani\Download\Zip with path to the source zip archive.
$zip = new Zip('path/to/a/local/or/www/archive.zip');

// Download and extract the zip archive to a local destination.
$zip->download('path/to/local/destination/folder');

Downloading a GitHub repository

The GitHub downloader allows downloading of a GitHub repository into a local folder.

<?php
use Bhittani\Download\GitHub;

// Create an instance of Bhittani\Download\GitHub with the name of respository.
$gitHub = new GitHub('org/repo');

// Download the GitHub repository to a local destination.
$gitHub->download('path/to/local/destination/folder');

Using a progress callback handler

The download instances also accept a progress callback.

$downloader = new \Bhittani\Download\GitHub('org/repo');

$downloader->callback(function ($transferred, $total, $time) {
    // $transferred will contain the number of bytes transferred.
    // $total will contain the total bytes.
    // $time will contain the time consumed in milliseconds.
});

$downloader->download('path/to/destionation/folder');

An stdout progress callback is available as an invocable class Bhittani\Download\Progress\Standard which may be useful for console output.

Changelog

Please see CHANGELOG for more information on what has changed.

Testing

git clone https://github.com/kamalkhan/download

cd download

composer install

composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email shout@bhittani.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see the License File for more information.

统计信息

  • 总下载量: 400
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-04-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固