custom-services-limited / oc-cli
Command line interface for OpenCart - Created by Custom Services Limited
Installs: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
Type:project
pkg:composer/custom-services-limited/oc-cli
Requires
- php: >=7.0
 - symfony/console: ^3.4|^4.0|^5.0|^6.0
 - symfony/filesystem: ^3.4|^4.0|^5.0|^6.0
 - symfony/yaml: ^3.4|^4.0|^5.0|^6.0
 
Requires (Dev)
- pcov/clobber: ^2.0
 - phpstan/phpstan: ^0.12|^1.0
 - phpunit/phpunit: ^6.5|^7.0|^8.0|^9.0
 - squizlabs/php_codesniffer: ^3.0
 - symfony/process: ^3.4|^4.0|^5.0|^6.0
 
This package is auto-updated.
Last update: 2025-10-17 18:44:35 UTC
README
A command-line interface for OpenCart, inspired by WP-CLI. OC-CLI provides a set of command-line tools for managing OpenCart installations without using a web browser.
Created by Custom Services Limited - Your OpenCart experts.
Features
- System Management: Check installation health, view version information
 - Database Operations: Backup, restore, and manage database
 - Product Management: Create, update, list, and delete products and categories
 - Order Management: View and manage orders
 - Extension Management: Install, activate, and manage extensions
 - Cache Management: Clear and rebuild caches
 - User Management: Manage admin users
 
Requirements
- PHP 7.0 or higher
 - OpenCart 2.x, 3.x, or 4.x installation
 - MySQL/MySQLi support
 - Composer (for installation)
 
Installation
Via Composer (Recommended)
composer global require custom-services-limited/oc-cli
Manual Installation
- Clone the repository:
 
git clone https://github.com/Custom-Services-Limited/oc-cli.git
cd oc-cli
- Install dependencies:
 
composer install
- Make the binary executable:
 
chmod +x bin/oc
- Add to your PATH (optional):
 
echo 'export PATH="$PATH:'$(pwd)'/bin"' >> ~/.bashrc source ~/.bashrc
Quick Start
- Navigate to your OpenCart installation directory:
 
cd /path/to/your/opencart
- Check if OC-CLI can detect your installation:
 
oc core:version
- List all available commands:
 
oc list
Basic Usage
Check OpenCart Version
oc core:version
System Information
oc core:check-requirements
Database Operations
# Show database info oc db:info # Backup database oc db:backup backup.sql # Restore database oc db:restore backup.sql
Extension Management
# List installed extensions oc extension:list # Install an extension oc extension:install extension_name # Enable an extension oc extension:enable extension_name # Disable an extension oc extension:disable extension_name # List modifications oc modification:list
Implementation Status
✅ = Implemented | 🚧 = Coming Soon (Help us by contributing!)
Core Commands ✅
- ✅ 
core:version- Display version information - ✅ 
core:check-requirements- Check system requirements - ✅ 
core:config- Manage OpenCart configuration 
Database Commands ✅
- ✅ 
db:info- Display database connection information - ✅ 
db:backup- Create database backup - ✅ 
db:restore- Restore database from backup 
Extension Commands ✅
- ✅ 
extension:list- List installed extensions - ✅ 
extension:install- Install an extension - ✅ 
extension:enable- Enable an extension - ✅ 
extension:disable- Disable an extension - ✅ 
modification:list- List installed modifications 
Product Commands ✅
- ✅ 
product:list- List products with filtering and search - ✅ 
product:create- Create a new product with full validation - 🚧 
product:update- Update an existing product - 🚧 
product:delete- Delete a product - 🚧 
category:list- List categories - 🚧 
category:create- Create a new category 
Order Commands 🚧
- 🚧 
order:list- List orders - 🚧 
order:view- View order details - 🚧 
order:update-status- Update order status 
Cache Commands 🚧
- 🚧 
cache:clear- Clear all caches - 🚧 
cache:rebuild- Rebuild caches 
User Commands 🚧
- 🚧 
user:list- List admin users - 🚧 
user:create- Create a new admin user - 🚧 
user:delete- Delete an admin user 
Available Commands
Configuration
OC-CLI can be configured using a .oc-cli.yml file in your OpenCart root directory:
# .oc-cli.yml database: backup_path: ./backups output: format: table # table, json, yaml cache: enabled: true
Database Connection Options
OC-CLI supports two methods for database connectivity:
1. OpenCart Installation Method (Traditional)
When running commands from within an OpenCart directory, OC-CLI automatically detects and reads database configuration from config.php.
2. Direct Database Connection (New)
For remote database access or when config.php is not available, use command-line database options:
# Connect directly to database oc product:list --db-host=localhost --db-user=oc_user --db-pass=password --db-name=opencart_db # All database connection options --db-host=<hostname> # Database hostname (default: localhost) --db-user=<username> # Database username --db-pass=<password> # Database password --db-name=<database> # Database name --db-port=<port> # Database port (default: 3306) --db-prefix=<prefix> # Database table prefix (default: oc_)
Database Schema Reference
For detailed information about OpenCart's database structure and how OC-CLI interacts with it:
- Database Schema Documentation - Comprehensive reference for all OpenCart tables
 - OpenCart 2.x & 3.x Structure - Complete database schema SQL file
 - Development Guide - Database integration patterns for developers
 - Commands Reference - Detailed command examples with database usage
 
Output Formats
Most commands support multiple output formats:
# Table format (default) oc product:list # JSON format oc product:list --format=json # YAML format oc product:list --format=yaml
Development
Running Tests
composer test
Code Style
composer cs-check composer cs-fix
Contributing
We welcome contributions! Many commands are marked as "🚧 Coming Soon" and need implementation.
How to contribute:
- Fork the repository
 - Look for commands marked with 🚧 in the Implementation Status section
 - Create a feature branch: 
git checkout -b feature/implement-product-commands - Implement the command following existing patterns in 
src/Commands/ - Add tests for new functionality in 
tests/ - Ensure all tests pass: 
composer test - Submit a pull request
 
Priority commands needing implementation:
- Additional product management commands (product:update, product:delete)
 - Order management commands
 - Cache management commands
 - User management commands
 - Category management commands
 
Development setup:
git clone https://github.com/Custom-Services-Limited/oc-cli.git cd oc-cli composer install composer test
Extending OC-CLI
You can create custom commands by extending the base Command class:
<?php namespace OpenCart\CLI\Commands\Custom; use OpenCart\CLI\Command; class MyCustomCommand extends Command { protected function configure() { $this ->setName('custom:my-command') ->setDescription('My custom command description'); } protected function handle() { $this->io->success('Hello from my custom command!'); return 0; } }
License
OC-CLI is open source software licensed under the GPL v3 license.
Support
- GitHub Issues - Bug reports and feature requests
 - Custom Services Limited - Professional OpenCart support
 - OpenCart Community Forum - General support
 
About Custom Services Limited
Custom Services Limited is a professional OpenCart development and support company. We provide:
- OpenCart development and customization
 - Extension development
 - Performance optimization
 - Technical support and consulting
 - Training and documentation
 
Visit us at https://support.opencartgreece.gr/ for more information about our services.
Legal Notice & Disclaimer
Important: This project is an independent, open-source tool created by Custom Services Limited and is NOT affiliated with, endorsed by, or officially connected to OpenCart Ltd. or the official OpenCart project.
- OpenCart is a registered trademark of OpenCart Ltd.
 - This CLI tool is developed independently to help OpenCart users manage their installations
 - We acknowledge that OpenCart is a trademark of OpenCart Ltd.
 - This project is released under the GPL v3 license as free, open-source software
 - Use of the OpenCart name in this project is purely for descriptive purposes to indicate compatibility
 - Custom Services Limited and the contributors of this project disclaim any affiliation with OpenCart Ltd.
 - This software is provided "as is" without warranty of any kind
 - Users assume all responsibility for using this tool with their OpenCart installations
 
Changelog
1.0.0
- Initial release with core commands
 - Database backup/restore functionality
 - Extension management commands
 - System requirements checking
 - OpenCart configuration management
 - PHP 7.0+ compatibility
 
