This module aims to help merchants to manage easily their documents in Magento 2.

Installs: 4 059

Dependents: 4

Suggesters: 0

Security: 0

Stars: 6

Watchers: 11

Forks: 2

Open Issues: 2


2.0.0 2021-07-16 10:45 UTC

This package is auto-updated.

Last update: 2024-05-29 04:48:51 UTC


Latest Stable Version License: MIT Packagist Packagist

This module aims to help merchants to manage easily their documents in Magento 2.


Magento 2 Open Source or Commerce edition is required.

Composer installation

Run the following composer command:

composer require opengento/module-document

Setup the module

Run the following magento command:

bin/magento setup:upgrade

If you are in production mode, do not forget to recompile and redeploy the static resources.


This module aims to help merchants to manage easily their documents in Magento 2.
Documents are sorted by types and can be manipulated with ease.

  • Declare new document types:

    • from the back-office
    • from xml config files
  • Create new documents:

    • from the back-office
    • from command line
    • from a cron job

Documents can be uploaded with a thumbnail. The default thumbnail of the document type can be used.
The thumbnail can be resized in order to optimize the performance.


How to declare a document type from config file

Create a new file resource_document_types.xml in the etc/ folder of your module:

<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:opengento:document:etc/resource_document_types.xsd">
    <documentType code="cert">

How to add a new import file processor

When files are import from command line or cron jobs, you cannot set manually metadata.
The code, name, and pivot field has to be filled and that is what the file import processor do.
If you need to implement your own logic on how a document should be created on the import fly, check the following code:

Implement the interface \Opengento\Document\Model\Document\ProcessorInterface:

namespace Vendor\Module\Model\Document\Processor;

use Opengento\Document\Api\Data\DocumentInterface;
use Opengento\Document\Api\Data\DocumentTypeInterface;
use Opengento\Document\Model\Document\Filesystem\File;
use Opengento\Document\Model\Document\Filesystem\Format;
use Opengento\Document\Model\Document\ProcessorInterface;
use Opengento\Document\Model\DocumentBuilder;
use function basename;
use function dirname;

final class CustomProcessor implements ProcessorInterface
    public const CODE = 'custom';

     * @var DocumentBuilder
    private $documentBuilder;

     * @var File
    private $fileHelper;

    public function __construct(
        DocumentBuilder $documentBuilder,
        File $fileHelper
    ) {
        $this->documentBuilder = $documentBuilder;
        $this->fileHelper = $fileHelper;

    public function execute(DocumentTypeInterface $documentType, string $filePath): DocumentInterface
        // $filePath is the path where the source file is currently saved.
        // You can change the destination path if want to.
        // Edit the file path value with $this->documentBuilder->setFilePath($newDestPath).
        // You can also rename the file with $this->documentBuilder->setFileName($newFileName)

        $destFilePath = $this->fileHelper->getFileDestPath($documentType, $filePath);
        $fileName = basename($destFilePath);


        return $this->documentBuilder->create();


Raise a new request to the issue tracker.


  • Opengento Community - Lead - Twitter Follow
  • Thomas Klein - Maintainer - GitHub followers
  • Contributors - Contributor - GitHub contributors


This project is licensed under the MIT License - see the LICENSE details.

That's all folks!