axel-php/axel
Composer 安装命令:
composer require axel-php/axel
包简介
Accelerated file downloads in PHP using Axel
README 文档
README
General
The AXEL-PHP library wraps around the C based Axel library. Axel performs accelerated downloads from the command line, similar to wget.
AXEL-PHP offers asynchronous and synchronous downloads. See below for usage.
AXEL-PHP also comes with an optional FIFO download manager with the ability to set numbers of current downloads. Just implement AxelDownloadManagerQueueInterface together with your favourite queuing service.
** PLEASE NOTE: This library is under active development as an alpha and is subject to change at any time. **
Example Usages
Sync Download With Complete Callback
$axel = new Axel\AxelDownload(); $axel->start('http://www.google.com', null, null, function($axel, $status, $success, $error) { echo 'File Downloaded'; print_r($status); });
Start Async Download
$axel = new Axel\AxelDownload(); $axel->startAsync('http://ipv4.download.thinkbroadband.com/1GB.zip', 'test.zip', '~/');
Start Async Download With Progress Callbacks
$axel = new Axel\AxelDownload(); $axel->startAsync('http://ipv4.download.thinkbroadband.com/1GB.zip', 'test.zip', '~/', function($axel, $status, $success, $error) { echo 'Progress updated'; print_r($status); });
Setup Download / Delayed Start
$axel = new Axel\AxelDownload(); $axel->addDownloadParameters([ 'address' => 'http://www.google.com', 'filename' => 'test.html', 'download-path' => '~/', 'callback' => function($axel, $status, $success, $error) { echo 'Progress updated'; print_r($status); } ]); $axel->startAsync();
Get Download Status
$status = $axel->updateStatus();
Cleanup
$axel->clearCompleted()
Axel Managed Download Queue (Synchronous)
$dm = new Axel\AxelDownloadManager(new AxelDownloadManagerSyncQueue(), 'axel'); $dm->queueDownload('http://www.google.com', 'file1.html'); $dm->queueDownload('http://www.yahoo.com', 'file2.html'); $dm->processQueue();
Version
0.0.13
Installation
Prerequesites
In order to install RPVR you will need:
- PHP 5.4 or higher
- Axel - A linux server with Axel installed
Install Instructions
The preferred method of installation is via Composer and Packagist.
- Install the axel command-line tool on the target system -
$ sudo apt-get install axel - Install the AXEL-PHP library -
$ composer require axel-php/axel
Development
Want to contribute? Great! Feel free to get in touch with me and we can collaborate, or fork / pull as you like.
TODO
- Possible log options / write to log file?
- Intelligently deal with both concurrent connections and concurrent downloads
- Check write permissions in download directory
- Pause queue (Maybe subclass?)
- Test queue Async
License
The MIT License (MIT)
Copyright (c) 2015 Ian Outterside (Ian Builds Apps).
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
axel-php/axel 适用场景与选型建议
axel-php/axel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 74 次下载、GitHub Stars 达 10, 最近一次更新时间为 2015 年 06 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「download」 「download manager」 「file download」 「download queue」 「download accelerator」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 axel-php/axel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 axel-php/axel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 axel-php/axel 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The NzoFileDownloaderBundle is a Symfony Bundle used to Download all types of files from servers and Web applications safely and with ease. You can also read/show the file content in the Web Browser.
The file manager intended for using Laravel with CKEditor / TinyMCE / Colorbox
Adds a download link next to assets
Laravel Media Popup to upload/view the files
PMVC Plugin for File information
Mapper for accessing resources in KWCMS
统计信息
- 总下载量: 74
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-06-03