anujpratap/create-cscart-addon

CLI tool to scaffold CS-Cart addons

Maintainers

Package info

github.com/AnujPratap-96/create-cscart-addon

pkg:composer/anujpratap/create-cscart-addon

Statistics

Installs: 4

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.2 2026-01-12 16:21 UTC

This package is auto-updated.

Last update: 2026-04-12 16:47:59 UTC


README

A PHP CLI tool to quickly scaffold a CS-Cart addon with a correct folder structure, namespaces, and boilerplate files.

No Node.js required.
Works on Windows, Linux, and macOS.

✨ Features

  • πŸ“¦ Generates CS-Cart–compatible addon structure
  • 🧩 PSR-4 autoloading
  • 🧠 Proper namespaces based on addon name
  • πŸ›‘ Validates addon name (letters, numbers, underscore)
  • ⚑ Fast CLI execution
  • 🌍 Cross-platform (Windows / Linux / macOS)

πŸ“ Generated Structure

my_addon/
β”œβ”€β”€ app/
β”‚   └── addons/
β”‚       └── my_addon/
β”‚           β”œβ”€β”€ controllers/
β”‚           β”œβ”€β”€ models/
β”‚           β”œβ”€β”€ schema/
β”‚           β”œβ”€β”€ src/
β”‚           β”‚   β”œβ”€β”€ HookHandlers/
β”‚           β”‚   β”œβ”€β”€ Bootstrap.php
β”‚           β”‚   β”œβ”€β”€ Installer.php
β”‚           β”‚   └── ServiceProvider.php
β”‚           └── addon.xml
β”œβ”€β”€ design/
β”‚   └── templates/
β”‚       └── addons/
β”‚           └── my_addon/
└── var/
    └── langs/
        └── addons/

πŸ“¦ Installation

βœ… Option 1: Install globally via Composer (recommended)

composer global require yourname/create-cscart-addon

Make sure Composer global bin is in your PATH:

# Linux / macOS
export PATH="$HOME/.composer/vendor/bin:$PATH"

# Windows (add manually)
C:\Users\YourUser\AppData\Roaming\Composer\vendor\bin

βœ… Option 2: Local usage (no global install)

php bin/create-cscart-addon my_addon

▢️ Usage

create-cscart-addon price_update

Or (Windows / local):

php create-cscart-addon.php price_update

πŸ§ͺ Validation Rules

βœ” Allowed

price_update
my_addon_123

❌ Not allowed

price-update
price update
price@update

🧩 Files Generated

addon.xml

  • Autoload (PSR-4)
  • Bootstrap
  • Installer
  • Active status

Bootstrap.php

  • Registers service provider
  • Hook handler support

Installer.php

  • Install / uninstall lifecycle
  • CS-Cart compliant

ServiceProvider.php

  • Dependency container support (Pimple)

πŸ–₯ Platform Notes

Windows

  • No chmod required
  • Composer generates .bat automatically

Linux / macOS

chmod +x bin/create-cscart-addon

πŸ›  Requirements

  • PHP 8.0+
  • Composer
  • CS-Cart 4.x+

πŸ—Ί Roadmap

  • Interactive mode
  • --force overwrite flag
  • Auto-detect CS-Cart root
  • Hook handler generator
  • Unit tests
  • Symfony Console integration

🀝 Contributing

PRs are welcome.

  1. Fork the repository
  2. Create a feature branch
  3. Submit a pull request

πŸ“„ License

MIT License

⭐ Why this tool?

CS-Cart addon development lacks a standard scaffold generator. This tool brings Laravel-level developer experience (DX) to CS-Cart.