Encodera

Thanks for reading!

Donate to the site — we work hard for you.

Contents

Introduction to Magento

Magento is a platform for online shops written in PHP. It is designed for large catalogs: thousands of products, several websites and languages, complex prices, warehouses and discounts. All of that is already in the core, and a developer extends the shop with their own modules.

Open Source and Adobe Commerce

NameWhat it is
Magento Open SourceThe free, open-source edition
Adobe CommerceThe paid edition: the same foundation plus extra features for large businesses

Modules for both editions are written the same way, so everything in this course applies to both.

Version

The course targets Magento 2.4 (releases 2.4.7 and 2.4.8). The code in the lessons uses PHP 8 features, such as declaring properties right in the constructor.

What you need

SoftwareWhy
PHP 8.2 or newerThe platform runs on it; exact versions depend on the release
Composer 2Downloads Magento and third-party packages
MySQL 8 or MariaDBThe database
OpenSearch 2Catalog search; the shop will not install without it
Nginx or ApacheThe web server

The exact list of versions for each release is in the System requirements section of the official documentation. The easiest way to get all of this running is Docker.

How Magento differs from other systems

Three things usually surprise a beginner:

  • A lot of configuration in XML. URLs, pages, tables, permissions — everything is described by XML files inside a module.
  • Objects are not created with new. A class lists what it needs in its constructor and Magento passes it in — this is called dependency injection.
  • Magento generates some classes automatically and puts them into the generated folder.

In return you get the main feature of the platform: almost any core behaviour can be changed from your own module without touching other people's files.

What the course builds

One example runs through the whole course — the Acme_Hello module in the app/code/Acme/Hello folder. First it shows a greeting page, then it learns to store product reviews: it gets its own table, an admin page, settings, an API and a console command.

app/code/Acme/Hello/
├── registration.php
└── etc/
    └── module.xml

This is what the module looks like after the "First module" lesson. Every following lesson adds new files to the tree.

Common mistake

Never edit core files in the vendor/magento folder: the changes disappear with the first update, and finding the cause of strange behaviour later is very hard. Every change is made from your own module or theme — that is what this course is about.

Thanks for reading!

Donate to the site — we work hard for you.