Universal OpenAPI specification to interactive CLI generator with pagination, auth, and table outputs in pure PHP 8.2+.
eidcloud-api-cli ingests any OpenAPI 3.0 / 3.1 or Swagger 2.0 specification and generates an interactive, high-performance command-line interface. Built with pure PHP 8.2+ with zero external vendor dependencies, it delivers instant command trees, encrypted local authentication management, automated pagination, input validation, ANSI box table rendering, and shell auto-completion.
flowchart TD
A["OpenAPI Spec (JSON / URL)"] --> B["SpecParser"]
B --> C["CliGenerator"]
C --> D["Dynamic Command Tree"]
D --> E["RequestValidator"]
E --> F["HttpClient (Native Streams)"]
F --> G["Response Processing"]
G --> H["ANSI Color Table"]
G --> I["Raw JSON"]
G --> J["CSV Export"]
K["AuthManager (AES-256 Storage)"] -.-> F
L["PaginationHandler (--auto-paginate)"] -.-> F
- Zero External Dependencies: 100% native PHP 8.2+ using native stream wrappers and OpenSSL encryption.
- Dynamic Command Synthesis: Maps REST paths to human-friendly subcommands:
api users listapi users get --id=10api users create --body='{"name": "Shadi"}'
- Interactive Authentication Management:
- Encrypted local profile storage with AES-256-CBC.
- Supports Bearer tokens, API Keys (header or query), and HTTP Basic Auth.
- Built-in Parameter Validation:
- Enforces required path, query, and header parameters with type coercion (integer, boolean, string, array, enum).
- Automated Pagination Engine:
- Traverses cursor and page/offset APIs seamlessly using
--auto-paginate,--page, and--limit.
- Traverses cursor and page/offset APIs seamlessly using
- Rich Output Formatting:
- Clean ANSI unicode box tables (
--table). - Standard JSON output for piping into
jq(--json). - CSV export for spreadsheets and data processing (
--csv).
- Clean ANSI unicode box tables (
- Shell Auto-Completion:
- Generates ready-to-use completion scripts for Bash and Zsh.
Clone the repository or install via Composer:
git clone https://github.com/eidcloud/eidcloud-api-cli.git
cd eidcloud-api-cliMake the binary executable:
chmod +x bin/eidcloud-api-cliphp bin/eidcloud-api-cli --helpTurn any OpenAPI specification into a standalone CLI executable tool:
php bin/eidcloud-api-cli generate examples/sample-openapi.json --name=myapi --out=./binNow use your generated tool:
php bin/myapi.php --help
php bin/myapi.php users list --limit=5 --table
php bin/myapi.php users get --id=1 --tableInvoke any endpoint directly from an OpenAPI specification without compiling:
# Render as ANSI table
php bin/eidcloud-api-cli call examples/sample-openapi.json /users GET --table
# Render specific user as JSON
php bin/eidcloud-api-cli call examples/sample-openapi.json /users/1 GET --json
# Export posts as CSV
php bin/eidcloud-api-cli call examples/sample-openapi.json /posts GET --limit=10 --csvStore and switch between credential profiles securely:
# Store Bearer Token
php bin/eidcloud-api-cli auth set prod --type=bearer --token=your_jwt_token_here
# Store API Key
php bin/eidcloud-api-cli auth set staging --type=apikey --name=X-API-Key --value=secret_key --in=header
# List configured profiles
php bin/eidcloud-api-cli auth list
# Execute with saved profile
php bin/eidcloud-api-cli call openapi.json /protected GET --profile=prod --tableGenerate completion scripts for your shell:
# Bash
php bin/eidcloud-api-cli completion bash > /etc/bash_completion.d/eidcloud-api-cli
# Zsh
php bin/eidcloud-api-cli completion zsh > ~/.zsh/completion/_eidcloud-api-cliRun the automated test runner (zero external testing dependencies required):
php tests/run_tests.phpAll tests for spec parsing, parameter validation, ANSI table formatting, encrypted authentication, and CLI compilation are executed.
Try eidcloud-api-cli directly in your browser without local setup:
Eng. MHD. Shadi AL-Hasan
- Role: Executive CTO & Enterprise Solutions Architect
- Email: mhd.shadi.alhasan@gmail.com
- Phone / WhatsApp: +963934005922
- Location: Damascus, Syria
- GitHub: shadialhasan
This project is licensed under the MIT License - see the LICENSE file for details.
Copyright (c) 2026 MHD. Shadi AL-Hasan. All rights reserved.