Download the PHP package viharm/php-aria2-rpc without Composer
On this page you can find all versions of the php package viharm/php-aria2-rpc. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download viharm/php-aria2-rpc
More information about viharm/php-aria2-rpc
Files in viharm/php-aria2-rpc
Package php-aria2-rpc
Short Description A PHP library to interact with Aria2 download manager via the Aria2 RPC interface
License BSD-3-Clause
Homepage https://github.com/viharm/phpAria2rpc
Informations about the package php-aria2-rpc
phpAria2rpc
Version | 2.4.0 |
Changes | https://github.com/viharm/phpAria2rpc/pull/7 |
Download | https://github.com/viharm/phpAria2rpc/releases |
Issues | https://github.com/viharm/phpAria2rpc/issues |
License | Modified BSD (3-clause) |
Language | PHP |
Library to communicate with aria2 using json-RPC.
Install
Pre-requisites
- PHP 5+ with cURL support
- Standard web framework (web server, etc.)
- Aria2 running in daemon mode either on the same host or on a different known host
Download
Archive
Get the release archives from downloads
Composer
From v2.4.0 onwards, phpAria2rpc is enabled for Composer, and is available on Packagist as viharm
/php-aria2-rpc
. This library can be installed standalone or included in any project with Composer usage.
Standalone
A standalone copy of this project can be installed with Composer
The above command will install phpAria2rpc in a sub-directory phpAria2rpc
of the current working directory.
Dependency
To make Composer automatically install phpAria2rpc as a dependency include the following in your composer.json
This will install phpAria2rpc in the standard vendor
sub-directory of a typical Composer-enabled project.
Clone
Clone repository.
Remember to clone recursively (--recurse-submodules
) to ensure cloning the submodules.
Deploy
Save the downloaded directory structure in your choice of path within your application (plugins, includes, etc.)
Configure
No specific configuration required yet.
Usage
Run Aria2 in daemon mode
There are several recommended options for configuring Aria2 however the minimum necessary to get started are...
--enable-rpc
--rpc-allow-origin-all
-c
-D
Assuming that the Aria2 binary is in your execution path, run it with the above options...
To enable auto-start on most Linux systems, add the following in /etc/rc.local
before the exit
line...
Use
Include the library in your application code
Create an instance
phpAria2rpc uses safe defaults for Aria2 running on the same host as the script is running on. See advanced usage for custom configuration
Once the object is created, the library tests the connection by querying the version of Aria2. The status (success or failure) of this query is saved in a boolean:
This boolean can be used in the logic of the calling function/script to formulate escape routes in case of connection failure.
Call Aria2 methods
Advanced usage
Advanced configuration allows custom settings. Formulate a server configuration array
This array is passed as a parameter only once, whilst creating an instance of the class.
phpAria2rpc inserts the correct value as per Aria2's requirement.
Further usage is normal, by calling Aria2 methods against phpAria2rpc.
Secure RPC
If Aria2 is configured for secure RPC, then set the secure
key value in the $server
array to TRUE
.
If self-signed certificates are used, then the appropriate CA certificate will have to be copied over to the host running this library and its path specified in the cacert
key value in the $server
array.
RPC secret token
If Aria2 has been configured with a secret token on the RPC interface then this should be specified in the rpcsecret
key value in the $server
array.
Legacy RPC authentication
phpAria2rpc can also be configured to connect to Aria2 daemons with the legacy username/password authentication for the RPC interface.
Please note that the use of this method of authentication is deprecated by the Aria2 authors, however still supported by phpAria2rpc for compatibility with older versions of Aria2 without the newer secret token authentication.
RPC username (legacy)
Specify the RPC username in the rpcuser
key value of the $server
array.
RPC password (legacy)
Specify the RPC password in the rpcpass
key value of the $server
array.
Connecting through proxy
phpAria2rpc allows connecting to the desired instance of Aria2 via proxy. This can be accomplished by adding an sub-array item proxy
to the array parameter passed to the class.
This sub-array associative and is used for setting the proxy configuration.
Please refer to the proxy configuration or documentation of your proxy service for information on values specific to the application environment.
It has the following elements.
Type
Use the value for the key type
to specify the type of proxy to use. Currently only http
and socks5
types are supported.
There is no default value for this parameter.
Host
Use the value for the key host
to specify the proxy host to use. Both IP addresses and resolvable host names are allowed.
There is no default value for this parameter.
Port
Use the value for the key port
to specify the port of the proxy service. This is the port that the proxy service is listening for connections on.
There is no default value for this parameter.
Proxy authentication
If the proxy server requires authentication, then this can be achieved by two more items in the proxy
sub-array.
Remember that this is different from the RPC authentication for Aria2.
-
Use the value for the key
user
to specify the username to authenticate with the proxy service.If
user
is not provided or isNULL
then phpAria2 does not attempt to authenticate with the proxy service. -
Use the value for the key
pass
to specify the password to authenticate with the proxy service.If
pass
is not provided or isNULL
, phpAria2 will use only the username to authenticate with the proxy service. While this scenario is unlikely, it allows connecting to proxy servers with non-standard setups.Proxy authentication with only username and without password depends on the proxy service and may fail if not configured properly.
Examples
Download a File
Returned Data
Can't Download
Downloading (Active)
Downloaded
Known limitations
- Aria2 does not set CA certificates, so for self-signed certificates, the CA cert file will have to be copied to the host running phpAria2rpc.
Support
Please refer to the documentation of Aria2
- http://aria2.sourceforge.net/manual/en/html/aria2c.html#rpc-interface for RPC interface.
- http://aria2.sourceforge.net/manual/en/html/aria2c.html for general options.
Debugging can be enabled by setting boolean $GLOBALS['bl_DebugSwitch']
to TRUE
.
Note, that this requires phpKhelper >= v01.02.01
For issues, queries, suggestions and comments please create an (issue/ticket][https://github.com/viharm/phpAria2rpc/issues).
Contribute
Please feel free to clone/fork and contribute via pull requests. Donations also welcome, simply create an issue/ticket.
Please make contact for more information.
Environment
Tested on:
- Debian Wheezy
- Debian Jessie
- Apache 2.2
- Apache 2.4
- PHP 5.4
- PHP 5.5
- Aria2 1.15.1 and 1.18.8
Licence
Licensed under the modified BSD (3-clause) license.
A copy of the license is available...
- in the enclosed
LICENSE
file. - at http://opensource.org/licenses/BSD-3-Clause
References
php-aria2
aria2.class.php
(2013-11-22)- Available in the public domain at https://github.com/shiny/php-aria2
- Author daijie (shiny)
Credits
Tools
Kint
Kint debugging library (http://raveren.github.io/kint/), used under the MIT license
Copyright (c) 2013 Rokas Å leinius (raveren at gmail dot com)
Utilities
Codiad
Codiad web based IDE (https://github.com/Codiad/Codiad), used under a MIT-style license.
Copyright (c) Codiad & Kent Safranski (codiad.com)
CodeGit
CodeGit Git plugin for Codiad (https://github.com/Andr3as/Codiad-CodeGit), used under a MIT-style license.
Copyright (c) Andr3as [email protected]
VS Code
Visual Studio Code code editor, used under the Microsoft Software License.
jEdit
jEdit text editor (http://www.jedit.org/), used under the GNU GPL v2.
Copyright (C) jEdit authors.
Ungit
Ungit client for Git (https://github.com/FredrikNoren/ungit) used under the MIT license
Copyright (C) Fredrik Norén
GitHub
Hosted by GitHub code repository (github.com).
All versions of php-aria2-rpc with dependencies
mnsami/composer-custom-directory-installer Version 1.1.*
viharm/php-khelper Version ^1.4.1