ScandiPWA
Create Magento AppCreate ScandiPWA AppUser ManualGitHub
  • Why Scandi
  • πŸš€Quick-start Guide
  • πŸ—ΊοΈRoadmap
  • Introduction to the Stack
    • CMA, CSA, and ScandiPWA
    • Challenges
  • Setting up Scandi
    • Storefront Mode Setup
      • Proxying requests to server
    • Magento Mode Setup
    • Existing Magento 2 setup
    • Magento Commerce Cloud setup
    • Updating to new releases
      • Storefront mode upgrade
      • Magento mode upgrade
      • CMA upgrade
      • CSA upgrade
      • Custom ScandiPWA composer dependency update
      • Local ScandiPWA Composer Package Setup
    • Docker Setup [deprecated]
      • Legacy Docker setup
      • Migrating to CMA & CSA
  • Developing with Scandi
    • Override Mechanism
      • Overriding JavaScript
        • Overriding classes
        • Overriding non-classes
      • Overriding Styles
      • Overriding the HTML / PHP
      • Parent Themes
    • Extensions
      • Creating an extension
      • Installing an extension
      • Migrating from 3.x to 4.x
      • Publishing an extension
      • Extension Terminology
    • Working With Magento
      • Magento troubleshooting
      • Working with Magento modules
      • Working with GraphQL
      • GraphQL Security
      • Working with "granular cache"
    • Developer Tools
      • Debugging in VSCode
      • ScandiPWA CLI
      • Configuring ESLint
      • CSA Commands
    • Deploying Your App
      • Build & Deploy Android app
      • Build & Deploy iOS app
  • Structure
    • Directory Structure
    • Building Blocks
      • Components
        • Styling Components
      • Routes
      • Redux Stores
      • GraphQL Queries
      • Global Styles
      • The Util Directory
      • Type Checking
    • Application assets
    • Code Style
      • JavaScript Code Style
      • SCSS Code Style
  • Tutorials
    • Customizing Your Theme
      • Styling
        • Customizing the Global Styles
        • Adding a New Font
        • Overriding a Components Styles
        • Extending a Component's Styles
      • Customizing JavaScript
        • Customizing the Footer Copyright
        • Adding a New Page
        • Adding a Section in My Account
        • Adding a Tab on the Product Page
        • Creating a New Redux Store
    • Payment Method Integration
      • Setting Up for Development
      • Redirecting to the Payment Provider
      • Handling the Customer's Return
    • Creating a Custom Widget
      • Scandi CMS System Overview
      • Creating a Magento Widget
      • Implementing the Rendering
    • Video Tutorials
      • #1 Setting up and talking theory
      • #2 Templating in React
      • #3 Overriding a file
      • #4 Styling the application
      • #5 Patterns of ScandiPWA
    • Dark Mode Extension
    • Deploying Native Apps
    • Product 3D Model Extension
      • Part 1: Magento 3D Model Uploads
      • Part 2: GraphQL API
      • Part 3: Scandi Frontend
    • Social Share, Full Extension Development
      • STEP-1 and 2 Creating Magento 2 Module
      • STEP-3 Backend Configurations Settings
      • STEP-4 Simple GraphQl and Resolver
      • STEP-5 Creating Extension, Base Redux Store
      • STEP-6 Extension plugins
      • STEP-7 GraphQL types, Helpers
      • STEP-8 Query Field and FieldList
      • STEP-9 render Plugins and MSTP Plugin, Component creation
      • STEP-10 SocialShare Component Development
      • STEP-11 SocialShare for CategoryPage
      • TASK-1 Changing LinkedIn to Twitter
      • STEP-12 Comments for Admin Users
      • STEP-13 Final, bugfixes
    • Accessing Magento 2 Controllers
      • STEP-1 Creating Magento 2 Module
      • STEP-2 - Create Magento 2 Frontend Route and Basic Controller
      • STEP-3 Accessing Magento 2 Controller, Bypassing ScandiPWA frontend
      • STEP-4 Creating ScandiPWA Extension with additional dependencies
      • STEP-5 Creating Plugin and Axios request
  • About
    • Support
    • Release notes
    • Technical Information
    • Data Analytics
    • Contributing
      • Installation from Fork
      • Repository structure
      • Code contribution process
      • Submitting an Issue
      • Publishing ScandiPWA
Powered by GitBook
On this page
  • Creating Magento 2 modules
  • Creating modules in app/code
  • Symlinking with composer
  • Installing Magento 2 modules
  • Composer way of installing Magento 2 extensions
  • Installing Magento 2 extensions with ZIP archives

Was this helpful?

  1. Developing with Scandi
  2. Working With Magento

Working with Magento modules

PreviousMagento troubleshootingNextWorking with GraphQL

Last updated 4 years ago

Was this helpful?

When developing Magento 2 back-end, all the functionality you would like to add must be located in a module. Magento 2 module may contain:

  • Changes to admin looks

  • Modifications to Rest API, GraphQL endpoints

  • Modifications to Magento 2 routes (not ScandiPWA routes)

Heads up!

Do not modify the vendor folder* (a place where Magento 2 logic appears to be), this folder is auto-generated for every user, any modifications will be erased during the next composer install. * you can do it for debugging, but do not forget to revert changes

Creating Magento 2 modules

There are two main ways to create a module in Magento 2:

  • - for project-specific modules

  • - for modules you intend to share

After that, you might need to create an initial file structure for your module. Take a look at to learn how to do that!

Creating modules in app/code

If you are building a module to be used by a single project, you can start by creating a new folder using a pattern <VENDOR>/<NAME> in app/code folder. For example: app/code/MyProject/MyModule.

Symlinking with composer

composer config repo.<MODULE NAME> add <PATH TO MODULE>
composer require <"name" FIELD FROM composer.json FILE>

Installing Magento 2 modules

Again, there are two ways:

  • Composer way

  • The ZIP way

After the installation, the following commands must be executed to enable and run post-install scripts of the extensions:

# see registration.php file to get Magento module name
magento module:enable <MAGENTO MODULE NAME>
magento setup:upgrade

Composer way of installing Magento 2 extensions

That's a very simple operation, which requires a single command:

composer require <COMPOSER PACKAGE NAME>

Heads up!

Installing Magento 2 extensions with ZIP archives

All you need to do is extract the ZIP archive of an extension to app/code direcory of your Magento 2 project. Make sure the created folder matches a pattern <VENDOR>/<NAME>. For example: app/code/OtherVendor/OtherModule.

If you are planning to share this module with other developers on or (or even within your company), opt-in to this approach. With it, you would need to define a composer.json for your package, and you might create it in any directory of your Magento 2 root (we prefer localmodules for example). Then, you need to symlink the package:

This approach is more complex for beginners. If you do not feel strong with composer it is probably better to create a module in app/code first, and then convert your module into a Composer one. See for more details.

If installing extensions from any Marketplace, or other - you must make sure your credentials are valid and set. CMA uses COMPOSER_AUTH environmental variable to authenticate, but there are . Usually, these credentials are provided by the marketplace in my account section.

And more!
Manually in app/code
Symlinking into vendor using composer
the official guide
ScandiPWA Marketplace
Magento Marketplace
this guide
private composer repositories
more ways to set the credentials