Skip to main content
v0.1.0 MIT · PHP 8.2+ · CodeIgniter 4.7 · HTMX 2
WinCart.ioSingle-TLD CodeIgniter 4 Cart

PSR-4 Modular Single-TLD Architecture

Seven Isolated Commerce Modules on CodeIgniter 4.7

Instead of scattering catalog, cart, payment, and admin code into a monolithic app/Controllers directory, WinCart maps each bounded domain to its own PSR-4 namespace in app/Config/Autoload.php while keeping swappable storefront templates in themes/.

/modules
  ├── Catalog/        # Products, Variants, Categories, Media, JSON-LD SEO helpers
  ├── Cart/           # Session + DB cart persistence, Totals/Tax/Discount pipeline
  ├── Checkout/       # Stock reservations, PaymentGatewayInterface, ShippingInterface
  ├── Orders/         # Immutable Order & OrderItem snapshots, State machine, Refunds
  ├── Customers/      # Saved addresses, Order history (wraps Shield User entities)
  ├── Admin/          # Store management UI, Metrics, Settings, Order fulfillment
  └── Storefront/     # Public controllers, Themeable views, Sitemap, Product feeds
/themes
  └── default/        # Swappable storefront templates overriding Storefront views
WinCart four-tier architecture diagram
WinCart isolates domain logic inside Modules\* namespaces so themes and payment drivers extend clean boundaries without touching framework internals.

First-Party Foundation

Assembled Almost Entirely From Official CI4 Packages

WinCart avoids fragile third-party dependency trees by building directly on audited first-party CodeIgniter 4 libraries.

codeigniter4/framework (^4.7)

Strict PHP 8.2+ typing, native CSRF and Content-Security-Policy filters, View Cells for reusable cart badges, and php spark CLI commands with sub-50ms execution overhead.

codeigniter4/shield (^1.4)

Handles customer registration, guest-to-customer order linking, admin RBAC permission matrices, session hardening, and personal access tokens out of the box.

codeigniter4/settings (^2.4)

Persists merchant configuration—currency ISO code, tax basis points, flat-rate shipping thresholds, and SMTP credentials—in MariaDB/MySQL with cached reads and app/Config/ defaults.

codeigniter4/queue (^1.0)

Ships with a native database queue driver so order confirmation emails, webhook retries, and receipt generation work reliably on standard PHP-FPM + MySQL hosts without Redis.

Extension Contracts & Lifecycle Events

Inspect Core Interfaces & Event Hooks

Third-party Composer packages subscribe to Events::trigger('cart.calculated'), Events::trigger('order.paid'), and Events::trigger('order.shipped') via auto-discovered Config/Events.php files without modifying a single core file.

Clean checkout driver contract — add Stripe, PayPal, or COD without core file edits or vQmod XML patches.Strict PHP 8.2+
<?php
declare(strict_types=1);

namespace Modules\Checkout\Contracts;

use CodeIgniter\HTTP\IncomingRequest;
use Modules\Checkout\DTO\OrderSnapshot;
use Modules\Checkout\DTO\PaymentSessionResult;
use Modules\Checkout\DTO\RefundResult;
use Modules\Checkout\DTO\WebhookResult;
use Modules\Orders\Entities\PaymentTransaction;

interface PaymentGatewayInterface
{
    public function getIdentifier(): string; // e.g. 'stripe', 'offline'

    public function initiatePayment(OrderSnapshot $checkout): PaymentSessionResult;

    public function handleWebhook(IncomingRequest $request): WebhookResult;

    public function refund(PaymentTransaction $tx, int $amountMinor): RefundResult;
}