M2IF is a powerful and easy to use framework for Magento 2 import services. The framework is not build as a Magento 2 extension, although it has no dependencies to other frameworks like Symfony, Laravel or others. Instead, it provides independent components, that can be tied together by DI and the Workflow Engine, as needed. Additionally it comes with an easy to use command line interface OOTB.
M2IF has a component based architecture and provides a plug-in mechanism to add new functionality. Each component is provided by it's own composer library. The main libraries, which are responsible for the core import functionality, have no dependencies to each other, whereas more specific ones, let's say the library for product variants, have dependencies to their main library.
Each library represents one or more components, that are responsible for a specific functionality, importing an entity like a simple product for example. Complimentary components adds additional functionality for configurable + bundle products, product relations or media gallery handling. These components are tied together by the Workflow Engine, which makes M2IF very flexible and allows to break down your import application to the smallest set of components that are necessary to fit the requirements of nearly every use case.
An individual software component is a software package that encapsulates a set of related functions or data (Wikipedia). M2IF provides the necessary components as well as a way to tie them thogether, to implement flexible, fine grained and well designed Magento 2 import services. The core components for the product, category and attribute import, each available for Magento 2 Open Source and Magento 2 Commerce, comes with the necessary functionality to import those entity types. They can be extended with additional components, if the requirements make that necessary.
A component usually comes in form of a plug-in, like the archive component does. Alternatively it may come in form of an extension for one of the core components, which usually means a set of classes, that'll be integrated via the Worklow Engine. This could be the case, if the product import has to be extended with some addtional functionality. In both cases, a component MUST be a GIT repository, e. g. on Github or a local repository with Composer support and a valid Symfony DI configuration on-board. Within the project, these component can be installed with Composer and referenced from the Workflow Engine's configuration. By adding the component's classes to the Workflow Engine, the functionality of the component will be executed in the appropriate step,
The Workflow Engine is the heart of M2IF and responsible for the invocation of the components in the specified order. The Workflow Engine can be configured with a JSON or a XML file, whereas the file does not reference the components classes directly, instead it uses the class identifier from the DI configuration, that is usually part of each component. Beside the main component configuration (operations, plug-ins, subjects, observers and callbacks) also the (multi-)database and logger configuration will be part of the Workflow Engine. This will be necessary, because there'll be use cases, where the M2IF will not be part of the Magento 2 instance, e. g. if the PHAR file will be used.
Components usually provides at least a plug-in and one or more subjects, observers and callbacks. The Workflow Engine will execute all plug-ins, subjects, observers and callbacks synchronously, as they've been defined by the configuration.
A plug-in may implement the import functionality, it is responsible for, by itself. But a much better and more generic solution will be to use the core subject plugin, which implements the observer pattern. For each configured plug-in, an unlimited number of subjects and related observers can be registered. Each import file, that'll be found, the plug-in will invoked all the subject's which again invoke the registered observers for each line found in the file. Finally all the callbacks, registered for an observer will be triggered on the field values they've been bound on and make sure, that the imported data will be converted, when necessary, and ensures the expected quality of the import's result.
As all of that can be configured by the Workflow Engine, M2IF gives you the necessary flexibility and power to strip down the import process to the most basic workflow that fit's the use cases requirements.