This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Akeeba Remote CLI is a PHP command-line tool for remotely managing backups via the Akeeba Backup JSON API. It supports Akeeba Backup for Joomla, Akeeba Backup for WordPress, and Akeeba Solo. Distributed as a PHAR archive, native binaries (via PHPacker), and Docker image.
Dependencies install to remotecli/vendor/ (non-standard path):
composer installBuild the PHAR package (requires Phing and external buildfiles repo at ../buildfiles):
phing remotecliBuild everything (PHAR + native binaries + docs):
phing allRun the tool locally during development:
php remotecli/remote.php <command> [options]remotecli/remote.php is the main entry point (not a typical bin/ script). It:
- Loads Composer autoloader and version info from
arccli_version.php - Parses CLI input and merges
~/.akeebaremotecliconfig file data - Sets up CA certificates (extracted to temp file for cURL compatibility with PHAR)
- Creates a
Dispatcherwith all registered command classes, then dispatches
remotecli/index.php is the PHAR stub that bootstraps remote.php inside a PHAR context.
The Dispatcher (Application/Kernel/Dispatcher.php) instantiates all command classes, matches the requested command name (from first positional arg or legacy --action option) to a class by lowercase class name comparison, then calls prepare() followed by execute().
All commands live in remotecli/Application/Command/ and extend AbstractCommand, which provides:
assertConfigured()— validates--hostand--secretare presentgetApiObject()— creates anAkeeba\BackupJsonApi\Connectorwith auto-detection of API versiongetDownloadOptions()— builds download config from CLI flags- Short option aliasing (
-h→--host,-s→--secret,-m→--machine-readable)
To add a new command: create a class extending AbstractCommand in the Command directory, implement prepare() and execute(), then register it in the $dispatcher array in remote.php.
- Input (
Application/Input/):Cliparses$_SERVER['argv']into named options and positional arguments.Filterprovides typed access (getInt,getBool,getCmd,getPath, etc.). Config from~/.akeebaremotecli(INI format with per-host sections) is merged viaLocalFile. - Output (
Application/Output/): Adapter pattern —Consolefor colored terminal output,Machinefor pipe-friendly structured output. Selected via--machine-readableflag. - Logging (
Application/Logger/): PSR-3 compliant.OutputLoggerwrites to console;FileLoggerwrites toremotecli_log.txtwhen--debugis used.MultiLoggercombines both.
The tool delegates all API communication to the akeeba/json-backup-api library (separate repo at github.com/akeeba/json-backup-api, included as a Composer @dev dependency). The Connector class handles API v1 (unencrypted) and v2 (encrypted) with auto-detection.
- Namespace:
Akeeba\RemoteCLI\maps toremotecli/(PSR-4, seecomposer.json) - PHP version: 8.0+ (platform locked to 8.0.999 in Composer config)
- Brace style: Allman (opening brace on its own line for classes, methods, and control structures)
- Copyright header: Every PHP file starts with the
@package AkeebaRemoteCLIdocblock - No unit tests: Testing is done via integration testing against live Akeeba Backup installations (PhpStorm run configs in
.run/)
- Build uses Phing (
build.xml) which imports shared build files from../buildfiles/phing/common.xml - Version string is templated:
build/templates/arccli_version.php→remotecli/arccli_version.php(tokens##VERSION##,##DATE##replaced at build time) - Native binaries built with PHPacker (configured in
phpacker.json) - Build artifacts go to
release/
- development branch: active development (default for PRs)
- main branch: releases only