custom-services-limited / oc-cli
Command line interface for OpenCart - Created by Custom Services Limited
Package info
github.com/Custom-Services-Limited/oc-cli
Type:project
pkg:composer/custom-services-limited/oc-cli
Requires
- php: ^7.4|^8.0
- psr/container: ^1.1
- symfony/console: ^4.4|^5.4
- symfony/filesystem: ^4.4|^5.4
- symfony/service-contracts: ^2.5
- symfony/yaml: ^4.4|^5.4
Requires (Dev)
- phpstan/phpstan: ^0.12|^1.0
- phpunit/phpunit: ^6.5|^7.0|^8.0|^9.0
- squizlabs/php_codesniffer: ^3.0
- symfony/process: ^4.4|^5.4
This package is auto-updated.
Last update: 2026-03-12 18:38:52 UTC
README
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.
Stable command surface
Registered OpenCart-focused commands in this repository:
Core
core:versioncore:check-requirementscore:config
Database
db:infodb:backupdb:restoredb:checkdb:repairdb:optimizedb:cleanup
Cache
cache:clearcache:rebuild
Extensions and modifications
extension:listextension:installextension:enableextension:disablemodification:list
Catalog
category:listcategory:createproduct:listproduct:createproduct:updateproduct:delete
Orders
order:listorder:vieworder:update-status
Admin users
user:listuser:createuser:delete
Requirements
- PHP 7.4 or newer
- Composer
- MySQL or MariaDB access for the target OpenCart database
- A real OpenCart installation root for runtime-backed commands
Support notes
- 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.
Installation
Global install:
composer global require custom-services-limited/oc-cli
Project-local install:
composer require --dev custom-services-limited/oc-cli
From this repository:
git clone https://github.com/Custom-Services-Limited/oc-cli.git
cd oc-cli
composer install
chmod +x bin/oc
Quick start
Run inside a real OpenCart 3.x root:
oc core:version oc core:check-requirements oc product:list --limit=5
Run DB-native commands from anywhere with direct DB credentials:
oc db:info \ --db-host=localhost \ --db-user=oc_user \ --db-pass=secret \ --db-name=opencart
Run runtime-backed commands from anywhere by pointing at a store root:
oc product:list --opencart-root=/var/www/opencart --status=enabled --limit=10
Common examples
Version and configuration:
oc core:version --opencart
oc core:config list
oc core:config get config_name
oc core:config set config_maintenance 1
Database maintenance:
oc db:backup nightly.sql --compress oc db:check oc db:optimize oc_product oc_order oc db:cleanup
Extensions 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:list
Categories 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 --force
Orders:
oc order:list --customer=John --limit=10
oc order:view 1
oc order:update-status 1 Processing --comment="Approved from CLI" --notify
Cache 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 --force
Output formats
Commands that expose --format support:
tablejsonyaml
Example:
oc order:list --format=json
Development
Useful checks:
composer test
composer test:e2e
composer cs-check
composer analyze
Additional documentation: