OC-CLI is a Symfony Console CLI for OpenCart. The current workspace ships a stable command surface for store inspection, configuration, database operations, extensions, modifications, products, categories, orders, cache maintenance, and admin-user management.
Created by Custom Services Limited.
Registered OpenCart-focused commands in this repository:
core:versioncore:check-requirementscore:config
db:infodb:backupdb:restoredb:checkdb:repairdb:optimizedb:cleanup
cache:clearcache:rebuild
extension:listextension:installextension:enableextension:disablemodification:list
category:listcategory:createproduct:listproduct:createproduct:updateproduct:delete
order:listorder:vieworder:update-status
user:listuser:createuser:delete
- PHP 7.4 or newer
- Composer
- MySQL or MariaDB access for the target OpenCart database
- A real OpenCart installation root for runtime-backed commands
- OC-CLI reads OpenCart connection details from
config.phpand related installation files, or from direct DB flags such as--db-host,--db-user, and--db-name. - Runtime-backed commands bootstrap real OpenCart 3.x models and cache paths. These commands require
--opencart-root=/path/to/opencartor execution from inside a real OpenCart 3.x installation root:cache:*category:*order:*product:*user:*
core:config --adminis deprecated. OpenCart stores settings in shared rows, so the flag is accepted only for backward compatibility and has no effect.extension:installimports OCMOD XML packages into the*_modificationtable. It is not a generic marketplace or ZIP installer.- Unsupported schema or version combinations fail explicitly instead of falling back to guessed SQL behavior.
Global install:
composer global require custom-services-limited/oc-cliProject-local install:
composer require --dev custom-services-limited/oc-cliFrom this repository:
git clone https://github.com/Custom-Services-Limited/oc-cli.git
cd oc-cli
composer install
chmod +x bin/ocRun inside a real OpenCart 3.x root:
oc core:version
oc core:check-requirements
oc product:list --limit=5Run DB-native commands from anywhere with direct DB credentials:
oc db:info \
--db-host=localhost \
--db-user=oc_user \
--db-pass=secret \
--db-name=opencartRun runtime-backed commands from anywhere by pointing at a store root:
oc product:list --opencart-root=/var/www/opencart --status=enabled --limit=10Version and configuration:
oc core:version --opencart
oc core:config list
oc core:config get config_name
oc core:config set config_maintenance 1Database maintenance:
oc db:backup nightly.sql --compress
oc db:check
oc db:optimize oc_product oc_order
oc db:cleanupExtensions and modifications:
oc extension:list payment
oc extension:disable shipping:flat
oc extension:enable shipping:flat
oc extension:install ./build/test.ocmod.xml --activate
oc modification:listCategories and products:
oc category:list --name=Desktops
oc category:create "CLI Specials" --parent-id=20 --keyword=cli-specials
oc product:create "CLI Demo Product" "CLI-DEMO-001" "19.99" --category=20 --status=enabled
oc product:update 100 --price=24.99 --quantity=8 --status=enabled
oc product:delete 100 --forceOrders:
oc order:list --customer=John --limit=10
oc order:view 1
oc order:update-status 1 Processing --comment="Approved from CLI" --notifyCache and admin users:
oc cache:clear --type=all
oc cache:rebuild --type=all
oc user:list --status=enabled
oc user:create cli-admin cli-admin@example.com 'StrongPass!123' --firstname=CLI --lastname=Admin
oc user:delete cli-admin --forceCommands that expose --format support:
tablejsonyaml
Example:
oc order:list --format=jsonUseful checks:
composer test
composer test:e2e
composer cs-check
composer analyzeAdditional documentation: