Download the PHP package daijie/aria2 without Composer
On this page you can find all versions of the php package daijie/aria2. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package aria2
Short Description talk with aria2
License WTFPL
Homepage https://github.com/shiny/php-aria2
Informations about the package aria2
php-aria2
Talking with aria2 through JSON-RPC
- Install
- Class Aria2
- Usage
- Batch Requests
- System Methods
- Example #1: Download File
- Example #2: The Returned Data
- Can't Download
- Downloading (Active)
- Downloaded
- Docker Playground
- Updates
- Contributors
Install
1. Install aria2c
Make sure aria2c is running and rpc is enabled, You can add this into /etc/rc.local
/usr/local/bin/aria2c --enable-rpc --rpc-allow-origin-all -c -D
2. Require Aria2.php
The codes just 82 lines but support all RPC methods. Using php's magic method __call
2.1 Install by composer
composer require daijie/aria2
2.2 Or copy Aria2.php
Class Aria2
Usage
Also See Manual of Aria2 RPC Interface To Get The Method List
.i.e, It's the example from Aria2 manual wrote in Python:
If you are using php with php-aria2:
Batch requests
Now php-aria2 support JSON-RPC 2.0 Specification Batch requests In v1.2.0 batch requests have been introduced.
Aria2::batch
- Start batch modeAria2::inBatch
- Detect batch modeAria2::commit
- End batch mode and commit commands
Another ways is anonymous function, it also support method chaining. Don't forget commit.
System methods
- system.multicall
- system.listMethods
- system.listNotifications
There are some system methods, you can call it using
- Aria2::system_multicall
- Aria2::system_listMethods
- Aria2::system_listNotifications
php-aria2 convert _
to .
automatically. If method name without a _
, php-aria2 will auto prepend a aria2.
Example #1: Download File
Example #2: The Returned Data
Case: Can't Download
Case: Downloading (Active)
Case: Downloaded
Docker Playground
require docker-compose
Docker playground: nginx (17 MB) + php7-fpm (82 MB) + aria2c (6 MB)
init playground
then open another terminal and enter playground
for China user we suggest use the phpcomposer mirror
After that, the playground structure:
Edit www/index.php and Open Browser To Visit http://127.0.0.1:8080
Updates
v1.2.1b
- add batch anonymous function
v1.2.0b
- Add system methods
- Add batch mode
v1.1
Now support default token(secret) in php-aria2, compatible with v1.0
Before
After
Contributors
- Dai Jie [email protected]
- Jon Skarpeteig
All versions of aria2 with dependencies
ext-curl Version *