mxi/ariarpc

aria2jsonrpc

v1.0.0 2021-11-21 09:20 UTC

This package is auto-updated.

Last update: 2025-06-21 17:20:26 UTC


README

介绍

用于aria2的jsonrcp库

软件架构

使用http jsonrcp管理aria2下载器,实现文件下载推送

安装教程

composer require mxi/ariarpc

使用说明

  • 创建实例
<?php
require 'vendor/autoload.php';
//第一个参数rpc地址,第二个参数rpc令牌
$rpc=new \Aria\JsonRPC('http://localhost:16800/jsonrpc');

  • 添加一个多源下载任务

多源任务下载失败时自动换源

$rs=$rpc->setUrls([$url,$url2])->call();
  • 添加一个单元下载任务

单源下载任务链式调用时自动创建多源下载任务

//创建单源任务
$rs=$rpc->setUrl($url)->call();
//创建多源任务
$rs=$rpc->setUrl($url)->setUrl($url1)->call();
  • 设置保存路径和保存文件名
$rs=$rpc->setUrl($url2)->setSaveName('out')->setSavePath('D:\WWW')->call();
  • 设置自定义参数
//删除所有自定义参数
$rpc->setArgs(array())->call();
//断点续传,伪装请求头
//$rpc->setArgs(['continue'=>'true','user-agent'=>'Transmission/2.77'])->call();

所有可选参数

		"allow-overwrite": "false",
        "allow-piece-length-change": "false",
        "always-resume": "true",
        "async-dns": "true",
        "auto-file-renaming": "true",
        "bt-enable-hook-after-hash-check": "true",
        "bt-enable-lpd": "false",
        "bt-force-encryption": "false",
        "bt-hash-check-seed": "true",
        "bt-load-saved-metadata": "false",
        "bt-max-peers": "55",
        "bt-metadata-only": "false",
        "bt-min-crypto-level": "plain",
        "bt-remove-unselected-file": "false",
        "bt-request-peer-speed-limit": "51200",
        "bt-require-crypto": "false",
        "bt-save-metadata": "true",
        "bt-seed-unverified": "true",
        "bt-stop-timeout": "0",
        "bt-tracker-connect-timeout": "60",
        "bt-tracker-interval": "0",
        "bt-tracker-timeout": "60",
        "check-integrity": "false",
        "conditional-get": "false",
        "connect-timeout": "60",
        "content-disposition-default-utf8": "false",
        "continue": "true",
        "dir": "./下载文件夹",
        "dry-run": "false",
        "enable-http-keep-alive": "true",
        "enable-http-pipelining": "false",
        "enable-mmap": "false",
        "enable-peer-exchange": "false",
        "file-allocation": "falloc",
        "follow-metalink": "true",
        "follow-torrent": "true",
        "force-save": "false",
        "ftp-pasv": "true",
        "ftp-reuse-connection": "true",
        "ftp-type": "binary",
        "hash-check-only": "false",
        "http-accept-gzip": "false",
        "http-auth-challenge": "false",
        "http-no-cache": "false",
        "lowest-speed-limit": "0",
        "max-connection-per-server": "5",
        "max-download-limit": "0",
        "max-file-not-found": "0",
        "max-mmap-limit": "9223372036854775807",
        "max-resume-failure-tries": "0",
        "max-tries": "5",
        "max-upload-limit": "0",
        "metalink-enable-unique-protocol": "true",
        "metalink-preferred-protocol": "none",
        "min-split-size": "10485760",
        "no-file-allocation-limit": "5242880",
        "no-netrc": "false",
        "out": "QQ66.exe",
        "parameterized-uri": "false",
        "pause-metadata": "false",
        "piece-length": "1048576",
        "proxy-method": "get",
        "realtime-chunk-checksum": "true",
        "remote-time": "false",
        "remove-control-file": "false",
        "retry-wait": "0",
        "reuse-uri": "true",
        "rpc-save-upload-metadata": "true",
        "save-not-found": "true",
        "seed-ratio": "0",
        "split": "5",
        "stream-piece-selector": "default",
        "timeout": "60",
        "uri-selector": "feedback",
        "use-head": "false",
        "user-agent": "Transmission/2.77"
  • 设置了魔术方法可实现自定义rpc指令

参与贡献

  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request