Components, extension or module in Yii 2?

I am new to yii and using version 2. I have developed a project that uses a library (coded) to parse a CAD model file, extract vertices, edges, faces, etc., finally combine these objects to display the model, and then extract functions. It displays the model using the three.js library. The user must be logged in to download the model file and do the whole thing. I would like to refactor my application to version 2 using the yii 2 framework. So I would like to know how can I bundle the function recognition library into a yii application, should I create components, extension or module, or use other means?

The library is coded in OOP. I access it by requiring a file init.php

that requires about 20 library class files. If I create a module for the library, the view draws the model, but where do the parser and function extractor go into the model or controller files?

Thanks in advance.

+3


source to share


1 answer


In Yii 2, there are basically all components.

Extension is a term commonly used for the vendors of the components (or modules) available on packagist.org (or similar), so unless you plan on releasing it outside, you don't have to worry about extending it.



Now for the discussion of a component, a module is a component that allows its own controller structure, so if you need something like this - use a module. In any other case, a simple component is just fine.

+2


source







All Articles