Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Magento 2 Developer's Guide

You're reading from   Magento 2 Developer's Guide Harness the power of Magento 2 to extend and customize your online store

Arrow left icon
Product type Paperback
Published in Dec 2015
Publisher Packt
ISBN-13 9781785886584
Length 412 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Toc

Table of Contents (14) Chapters Close

Preface 1. Understanding the Platform Architecture FREE CHAPTER 2. Managing the Environment 3. Programming Concepts and Conventions 4. Models and Collections 5. Using the Dependency Injection 6. Plugins 7. Backend Development 8. Frontend Development 9. The Web API 10. The Major Functional Areas 11. Testing 12. Building a Module from Scratch Index

The module filesystem structure

Magento identifies itself as a highly modular platform. What this means is that there is literally a directory location where modules are placed. Let's take a peak at the individual module structure now. The following structure belongs to one of the simpler core Magento modules—the Contact module that can be found in vendor/magento/module-contact:

  • Block
  • composer.json
  • Controller
  • etc
    • acl.xml
    • adminhtml
      • system.xml
    • config.xml
    • email_templates.xml
    • frontend
      • di.xml
      • page_types.xml
      • routes.xml
    • module.xml
  • Helper
  • i18n
  • LICENSE_AFL.txt
  • LICENSE.txt
  • Model
  • README.md
  • registration.php
  • Test
    • Unit
      • Block
      • Controller
      • Helper
      • Model
  • view
    • adminhtml
    • frontend
      • layout
      • contact_index_index.xml
      • default.xml
    • templates
      • form.phtml

Even though the preceding structure is for one of the simpler modules, you can see that it is still quite extensive.

The Block directory is where the view-related block PHP classes are located.

The Controller directory is where the controller-related PHP classes are stored. This is the code that responds to the storefront POST and GET HTTP actions.

The etc directory is where the module configuration files are present. Here, we can see files such as module.xml, di.xml, acl.xml, system.xml, config.xml, email_templates.xml, page_types.xml, routes.xml, and so on. The module.xml file is an actual module declaration file. We will look into the contents of some of these files in the later chapters.

The Helper directory is where various helper classes are located. These classes are usually used to abstract various store configuration values into the getter methods.

The i18n directory is where the module translation package CSV files are stored.

The Module directory is where the entities, resource entities, collections, and various other business classes can be found.

The Test directory stores the module unit tests.

The view directory contains all the module administrator and storefront template files (.phtml and .html) and static files (.js and .css).

Finally, the registration.php is a module registration file.

You have been reading a chapter from
Magento 2 Developer's Guide
Published in: Dec 2015
Publisher: Packt
ISBN-13: 9781785886584
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image