laravel-aria2

Configuration

Optionally, you can publish the config file using:

php artisan vendor:publish --tag=aria2-config

Point the client at your daemon with these environment variables. ARIA2_RPC_URL defaults to http://127.0.0.1:6800/jsonrpc. ARIA2_RPC_SECRET is sent as token:<secret> on every call.

ARIA2_RPC_URL=http://127.0.0.1:6800/jsonrpc
ARIA2_RPC_SECRET=change-me

The published file has two shapes. Legacy flat keys stay so existing env files keep working. Nested rpc and transfer arrays are the public package shape.

return [
'rpc_url' => env('ARIA2_RPC_URL', 'http://127.0.0.1:6800/jsonrpc'),
'rpc_secret' => env('ARIA2_RPC_SECRET'),
'request_timeout_sec' => 10,
'poll_ms' => 200,
'metadata_timeout_sec' => 180,
 
'rpc' => [
'url' => env('ARIA2_RPC_URL', 'http://127.0.0.1:6800/jsonrpc'),
'secret' => env('ARIA2_RPC_SECRET'),
'timeout' => 10,
],
 
'transfer' => [
'poll_ms' => 200,
'metadata_timeout' => 180,
'continue' => true,
'seed_time' => 0,
'seed_ratio' => 0,
],
];

When both shapes are populated, the reader prefers the legacy keys. mergeConfigFrom only merges the first level, so publish the full rpc and transfer arrays when you override them.

rpc.url and rpc_url are the JSON-RPC URL. rpc.secret and rpc_secret are the optional RPC secret. rpc.timeout and request_timeout_sec are the HTTP timeout for a single RPC request, in seconds, with a minimum of 1.

transfer.poll_ms and poll_ms control how often tellStatus is polled during a transfer, in milliseconds, with a minimum of 50. transfer.metadata_timeout and metadata_timeout_sec control how long metadata probes may wait, in seconds, with a minimum of 1.

transfer.continue is the default continue option for new downloads. transfer.seed_time is the default seed-time in seconds. transfer.seed_ratio is the default seed-ratio. Set either seeding value to 0 to disable that kind of seeding.

Read configuration through the package. Do not call config('aria2.rpc_url', '...') with a default from application code. The typed reader already applies defaults.