Commerce framework
The Adobe Commerce and Magento Open Source framework (Commerce framework) controls how application components interact, including request flow, routing, indexing, caching, and exception handling. It provides services that reduce the effort of creating modules that contain business logic, contributing to the goal of both making Commerce code more modular as well as decreasing dependencies.
This primarily PHP software component is organized into logical groups called libraries, which all modules can call. Most of the framework code sits under the domain layer or encloses the presentation, service, and domain layers. The framework contains no business logic. (Although the Commerce framework does not contain resource models, it does contain a library of code to help implement a resource model.)
data-variant=success
data-slots=text
You should never modify framework files, although if you are extending Commerce, you must know how to call framework libraries. Modules you create will typically inherit from classes and interfaces defined in the framework directories.
Responsibilities
The Commerce framework provides libraries that help reduce the effort of creating modules that contain business logic.
The Framework is responsible for operations that are useful for potentially all modules, including:
-
handling HTTP protocols
-
interacting with the database and filesystem
-
rendering content
Organization
Here is the Commerce framework folder structure:
vendor/
../magento
../framework
lib/
../internal
../LinLibertineFont
../web
-
/vendor/magento/frameworkcontains 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 example, libraries in the Framework help implement a resource model (base classes and interfaces to inherit from) but not the resource models themselves. Certain libraries also support CSS rendering. -
/lib/internalcontains some non-PHP as well as PHP components. Non-PHP framework libraries includes JavaScript and LESS/CSS. -
/lib/webcontains JavaScript and CSS/LESS files. These files reside underweband notinternalbecause they are accessible from a web browser, while the PHP code underinternalis not. (Any code that a web browser must access should be underweb, while everything else underinternal.)
data-variant=success
data-slots=text
vendor/magento/framework directory maps to the Magento\Framework namespace.Framework highlights
The Commerce framework (lib/internal/Magento/Framework/) provides a robust range of functionality. If you are an extension developer, you may be interested in this subset of Framework namespaces.
Other namespaces under Magento\Framework that will interest extension developers: