Book Image

Mastering Magento 2 - Second Edition

By : Bret Williams, Andre Gugliotti, Jonathan Bownds
Book Image

Mastering Magento 2 - Second Edition

By: Bret Williams, Andre Gugliotti, Jonathan Bownds

Overview of this book

The long-awaited release of the world's most popular online solution, Magento 2, is now out with an all new interface and several enhancements. This book offers you advanced guidance on managing, optimizing, and extending your store while taking advantage of the new features of Magento 2. This is a comprehensive guide to using the all new features and interface of Magento 2 to build, extend, and design online stores. From planning your Magento installation through to advanced techniques designed to make your store as successful as possible, this book is your roadmap to managing your Magento store. Focusing on Magento's Community version, the book covers everything from creating and managing multiple stores to fine-tuning Magento for speed and performance. You’ll learn how to manage categories, products, design themes, extensions, and more.
Table of Contents (18 chapters)
Mastering Magento 2 Second Edition
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface
Index

The new Magento module architecture


Much like Magento 1.0, Magento 2 is divided into modules. These modules are meant to encapsulate functionality related to a certain business feature. The framework provides organization for these modules, which can be found in the app/code directory with the following convention: app/code/(vendor)/(modulename).

Under the (modulename) directory, there are a series of nested directories that contain the blocks, helpers, controllers, and models that make up a module. The hierarchy looks like this:

Module architecture with nested directories

The following is a brief description of these directories and the programmatic roles of the files they contain:

  • Block/: This directory has PHP classes that contain logic to manage the view template. Blocks, therefore, are fundamentally related to display logic and are key to managing this logic.

  • Controller/: This directory contains controllers for the module. A controller is responsible for routing requests in Magento, and...