THE APP DEVELOPMENT FRAMEWORK OF MAGENTO
The Magento app development framework manages the interaction of application components containing request flow, routing, indexing, caching, and exception handling. This framework can provide services reducing the effort of creating modules include business logic, contributing to make Magento code more modular and decrease dependencies.
The logical groups named “libraries” included primary PHP software components. Most of the framework code sits under the domain layer or encloses the presentation, service, and domain layers. Normally, the framework contains no business logic. (This framework does not possess resource models but it does have a library of code to implement a resource model.)
Modifying app development framework files is unnecessary. If you are extending Magento, you just need to call Framework libraries. Modules you create will typically inherit from classes and interfaces defined in the Framework directories.
Next up, we will introduce to you about responsibilities, operations and highlights of the Magento app development framework.
The libraries supplied by the Magento framework will reduce your effort in creating modules including business logic.
The operations (responsible by the framework) are useful for potentially all modules, concluding:
- handling HTTP protocols
- interacting with the database and filesystem
- rendering content
Here is the Magento App Development Framework folder structure:
- /vendor/magento/framework includes only PHP code. These are libraries of code plus the application entry point that routes requests to modules (that in turn call the Framework libraries). For instance, libraries in the Framework help implement a resource model (base classes and interfaces to inherit from) but not the resource models themselves. While certain libraries also support CSS rendering.
- The vendor/magento/framework directory maps to the Magento\Framework namespace.
Highlights of Magento Framework
The Magento structure (lib/internal/Magento/Framework/) provides a robust range of functionality. Perhaps, extension developers may be interested in this subset of Framework namespaces.
|Magento\Framework\DataObject||Standard functionality for storing and retrieving data, which is the base class for many Magento classes.|
|Magento\Framework\Model||Base Model classes that almost all Magento Model classes extend from.|
|Magento\Framework\Controller||Classes to help return different types of results (for example, redirects).|
|Magento\Framework\View||Code to render pages and layouts.|
|Magento\Framework\Data||Additional classes that handle forms.|
|Magento\Framework\Url||Code to look up other pages in Magento.|
Other namespaces under Magento\Framework that will interest extension developers:
|Magento\Framework\ObjectManager||Provide dependency injection.|
|Magento\Framework\App||Framework code of the Magento application. Functions of this code: bootstraps the application, reads in initial configuration, contains the entry point to the command line tools/the web application/the cron job,routes requests, provides the deployment context.|
|Magento\Framework\Api||Base classes for advanced functionality of extendable objects through the system (Add new data through Magento Marketplace extensions to extend objects).|
|Magento\Framework\Config||The generic configuration reader file which has its own specialized reader extending these classes.|
|Magento\Framework\Filesystem||Classes that handle reading from and writing to the file system.|
|Magento\Framework\Stdlib\Cookie||Code to handle the HTTP request/responses with session/cookies is found here.|
|Magento\Framework\Exception||The basic exceptions that are thrown via the Magento codebase.|
|Magento\Framework\Event||Code which publishes synchronous events that handles observers for any Magento event is handled here.|
|Magento\Framework\Validator||Code that validates data (currencies, not empty) and handles observers for any Magento event.|