Magento 2 modules for learning, experimenting, and quickly implementing common features.
This repository provides a set of standalone modules, each focusing on a specific concept or feature in Magento 2. The goal is to make learning Magento 2 development easier by offering ready-to-use code samples that demonstrate best practices in a clean and minimal way. Clone it, try out the modules, and see how Magento 2 works under the hood.
-
Modular Structure:
Each folder is a separate, fully functional Magento 2 module. Pick only the samples you need—no bloated codebase or tangled dependencies! -
Comprehensive Coverage:
The modules cover a wide range of core Magento 2 topics, including:- Backend Development:
Custom models, resources, and collections for efficient database interactions. - Frontend Development:
Adding new pages, custom templates, and managing layouts. - API Development:
Building custom REST APIs and exposing Magento data. - CLI Commands:
Creating bespoke command-line tools for Magento administration. - Cron Jobs:
Automating scheduled tasks within Magento. - Plugins & Observers:
Extending core functionality the Magento way—without core hacks.
- Backend Development:
-
Hands-On Learning:
Each module is designed to be minimal, clear, and focused—perfect for use alongside tutorials, or as boilerplate for your own projects.
Below is a table listing all modules included in this repository, along with a brief description of each.
Module | Description |
---|---|
SMG_Minimal | Minimal example module demonstrating the basic structure of a Magento 2 module. |
SMG_WebFlow | Demonstrates frontend page creation, routing, and layout XML usage. |
SMG_RestApiTest | Provides a custom REST API endpoint and demonstrates API registration. |
SMG_CustomCache | Shows how to implement custom cache types and caching strategies. |
SMG_CustomCron | Demonstrates creation and scheduling of custom cron jobs in Magento 2. |
SMG_CustomAddProductAttribute | Teaches adding new product attributes programmatically during module setup. |
SMG_OrderExtensionAttribute | Demonstrates how to add extension attributes to order entities. |
SMG_CustomCustomerAttribute | Shows how to add custom attributes to customer entities. |
SMG_CustomShippingCarrier | Demonstrates creation of a custom shipping carrier for checkout. |
SMG_DeliveryCarrier | Sample module for implementing delivery carrier functionality. |
SMG_CustomPaymentOffline | Shows how to add a custom offline payment method. |
SMG_AddCheckoutStep | Teaches how to add a custom step to the checkout process. |
SMG_AddCheckoutAddressField | Demonstrates adding custom address fields in checkout. |
SMG_CartItemRenderer | Shows how to customize cart item rendering in the frontend. |
SMG_CheckoutDeliveryDate | Adds a delivery date field to the checkout and saves it with the order. |
SMG_CheckoutValidateBeforePlaceOrder | Demonstrates validation logic before order placement in checkout. |
SMG_ControllerResponseTypes | Shows different controller response types (JSON, redirect, etc.). |
SMG_CoreExtended | Demonstrates extending core Magento functionality via preferences or plugins. |
SMG_CustomCommand | Shows how to create custom CLI commands for bin/magento. |
SMG_CustomerTelephoneValidate | Adds custom validation for customer telephone fields. |
SMG_CustomFee | Demonstrates adding a custom fee to the quote and order totals. |
SMG_CustomFieldToQuoteItem | Shows how to add a custom field to quote items. |
SMG_CustomProductAttribute | Teaches adding custom product attributes and their management. |
SMG_CustomRoute | Demonstrates defining custom frontend or admin routes. |
SMG_EmailChecker | Shows email validation or checking logic during customer registration. |
SMG_ExemptProductType | Demonstrates how to exempt specific product types from validation or logic. |
SMG_News | Sample module for creating a simple news entity and frontend display. |
SMG_PluginExample | Demonstrates usage of plugins (interceptors) for method modification. |
SMG_RestApiProductComment | Adds a REST API for product comments or reviews. |
SMG_SendOrder | Shows how to send order data to external systems or via custom logic. |
SMG_RabbitMQExample | Demonstrates message queue usage with RabbitMQ integration. |
-
Clone the Repository:
git clone https://github.com/supravatm/magento2-basic-modules.git
-
Install Modules:
- Copy the desired module folder(s) into your Magento 2 installation's
app/code
directory. - Enable the module(s) using Magento CLI:
php bin/magento setup:upgrade
- Copy the desired module folder(s) into your Magento 2 installation's
-
Explore & Experiment:
- Check each module’s README (if available) for details.
- Use the code for learning, reference, or as a starting point for your own projects.
- Magento 2 Beginners:
Learn how the framework works by seeing real, working code samples. - Experienced Developers:
Grab quick references and boilerplate implementations for common tasks. - Tutorial Writers & Trainers:
Use the modules as teaching aids or demo resources.
This repository is licensed under the MIT License.
Feel free to use, adapt, and share!
© 2018 Supravat M