Skip to main content

Project Structure

Understanding how Alfa Commerce is organized is essential before contributing or extending it.

Directory Overview

Alfa-Commerce/
├── administrator/ # Backend admin panel
│ ├── src/
│ │ ├── Extension/ # Component bootstrap (AlfaComponent.php)
│ │ ├── Controller/ # Admin controllers (Form + List)
│ │ ├── Model/ # Admin models (CRUD, queries)
│ │ ├── View/ # Admin views
│ │ ├── Table/ # Database table classes
│ │ ├── Field/ # Custom form field types
│ │ ├── Helper/ # Business logic helpers
│ │ ├── Service/ # Services (PriceIndexSyncService)
│ │ ├── Event/ # Event classes
│ │ └── Plugin/ # Base plugin classes
│ ├── forms/ # XML form definitions
│ ├── tmpl/ # Admin HTML templates
│ ├── sql/ # Database schemas & migrations
│ │ ├── install.mysql.utf8.sql
│ │ ├── uninstall.mysql.utf8.sql
│ │ └── updates/mysql/ # Version migration scripts (e.g. 1.0.9.sql)
│ ├── services/ # DI container (provider.php)
│ ├── layouts/ # Reusable template layouts
│ ├── languages/ # Localization (en-GB)
│ ├── config.xml # Component configuration form
│ └── access.xml # ACL permissions

├── site/ # Frontend customer-facing
│ ├── src/
│ │ ├── Controller/ # Frontend controllers
│ │ ├── Model/ # Frontend models
│ │ ├── View/ # Frontend views
│ │ ├── Service/ # Pricing engine
│ │ │ └── Pricing/ # Money, PriceResult, PriceContext, etc.
│ │ ├── Helper/ # CartHelper, OrderPlaceHelper, PriceSettings
│ │ └── Dispatcher/ # Request dispatcher
│ ├── forms/ # Frontend forms
│ ├── tmpl/ # Frontend templates
│ └── languages/ # Frontend localization

├── api/ # REST JSON-API
│ └── src/
│ ├── Controller/ # REST API controllers
│ └── View/ # JSON response views

├── plugins/ # Core ships only the `standard` reference plugins;
│ │ # real gateways/carriers are premium (distributed separately)
│ ├── alfa-payments/
│ │ └── standard/ # Offline payment (bank transfer / cash on delivery)
│ ├── alfa-shipments/
│ │ └── standard/ # Standard shipping (flat / zone rates)
│ ├── alfa-form-fields/ # Form field type plugins
│ │ ├── text/
│ │ ├── textarea/
│ │ ├── tel/
│ │ └── choice/
│ ├── webservices/alfa/ # API route registration
│ └── system/alfasync/ # Post-install integrity & per-language schema sync

├── modules/
│ ├── mod_alfa_cart/ # Shopping cart widget module
│ └── mod_alfa_search/ # Product search module

├── media/com_alfa/ # Static assets
│ ├── css/ # Stylesheets (admin + site)
│ ├── js/ # JavaScript (admin + site)
│ ├── images/ # Component images
│ └── joomla.asset.json # Joomla asset registry

├── alfa.xml # Package manifest
├── script.php # Install/update/uninstall script
├── .php-cs-fixer.php # Code style configuration
├── phpstan.neon # Static analysis configuration
├── CONTRIBUTING.md # Contribution guide
└── .github/workflows/ # CI/CD automation

Namespaces

Alfa Commerce follows PSR-4 autoloading with Joomla 6/7 namespace conventions:

ComponentNamespace
AdminAlfa\Component\Alfa\Administrator\{Controller,Model,View,...}
SiteAlfa\Component\Alfa\Site\{Controller,Model,View,...}
APIAlfa\Component\Alfa\Api\{Controller,View}
Payment PluginsAlfa\Plugin\AlfaPayments\{PluginName}\Extension
Shipment PluginsAlfa\Plugin\AlfaShipments\{PluginName}\Extension
Field PluginsAlfa\Plugin\AlfaFormFields\{PluginName}\Extension
Cart ModuleAlfa\Module\AlfaCart
Search ModuleAlfa\Module\AlfaSearch

Naming Conventions

PatternExample
ControllersItemController, ItemsController
ModelsItemModel, CategoriesModel
ViewsItems\HtmlView, Items\JsonapiView
TablesItemTable
EventsAdminOrderViewEvent, PaymentResponseEvent
HelpersCartHelper, OrderPaymentHelper

Key Files to Know

FilePurpose
administrator/services/provider.phpDI container — registers all component services
administrator/src/Extension/AlfaComponent.phpComponent bootstrap class
site/src/Helper/CartHelper.phpShopping cart logic
site/src/Helper/OrderPlaceHelper.phpOrder placement flow
site/src/Service/Pricing/Complete pricing engine
administrator/src/Event/All event classes
administrator/src/Plugin/Base plugin classes (Plugin, PaymentsPlugin, ShipmentsPlugin)
administrator/sql/install.mysql.utf8.sqlComplete database schema