{"id":24066144,"url":"https://github.com/opengento/magento2-document","last_synced_at":"2025-04-23T21:02:36.949Z","repository":{"id":57032219,"uuid":"319088852","full_name":"opengento/magento2-document","owner":"opengento","description":"This module aims to help merchants to manage easily their documents in Magento 2.","archived":false,"fork":false,"pushed_at":"2024-08-11T17:20:16.000Z","size":198,"stargazers_count":6,"open_issues_count":2,"forks_count":2,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-23T21:02:11.687Z","etag":null,"topics":["document-management","magento","magento-2","magento-extension","magento-module","magento2","magento2-extension","magento2-extension-free","magento2-module","php"],"latest_commit_sha":null,"homepage":"https://opengento.fr","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opengento.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-06T17:19:03.000Z","updated_at":"2024-08-11T17:20:19.000Z","dependencies_parsed_at":"2022-08-23T17:40:58.343Z","dependency_job_id":null,"html_url":"https://github.com/opengento/magento2-document","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opengento%2Fmagento2-document","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opengento%2Fmagento2-document/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opengento%2Fmagento2-document/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opengento%2Fmagento2-document/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opengento","download_url":"https://codeload.github.com/opengento/magento2-document/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250514772,"owners_count":21443209,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["document-management","magento","magento-2","magento-extension","magento-module","magento2","magento2-extension","magento2-extension-free","magento2-module","php"],"created_at":"2025-01-09T11:19:56.636Z","updated_at":"2025-04-23T21:02:36.926Z","avatar_url":"https://github.com/opengento.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Document Module for Magento 2\n\n[![Latest Stable Version](https://img.shields.io/packagist/v/opengento/module-document.svg?style=flat-square)](https://packagist.org/packages/opengento/module-document)\n[![License: MIT](https://img.shields.io/github/license/opengento/magento2-document.svg?style=flat-square)](./LICENSE) \n[![Packagist](https://img.shields.io/packagist/dt/opengento/module-document.svg?style=flat-square)](https://packagist.org/packages/opengento/module-document/stats)\n[![Packagist](https://img.shields.io/packagist/dm/opengento/module-document.svg?style=flat-square)](https://packagist.org/packages/opengento/module-document/stats)\n\nThis module aims to help merchants to manage easily their documents in Magento 2.\n\n - [Setup](#setup)\n   - [Composer installation](#composer-installation)\n   - [Setup the module](#setup-the-module)\n - [Features](#features)\n - [Settings](#settings)\n - [Documentation](#documentation)\n - [Support](#support)\n - [Authors](#authors)\n - [License](#license)\n\n## Setup\n\nMagento 2 Open Source or Commerce edition is required.\n\n### Composer installation\n\nRun the following composer command:\n\n```\ncomposer require opengento/module-document\n```\n\n### Setup the module\n\nRun the following magento command:\n\n```\nbin/magento setup:upgrade\n```\n\n**If you are in production mode, do not forget to recompile and redeploy the static resources.**\n\n## Features\n\nThis module aims to help merchants to manage easily their documents in Magento 2.  \nDocuments are sorted by types and can be manipulated with ease.\n\n- Declare new document types:\n  - from the back-office\n  - from xml config files\n\n- Create new documents:\n  - from the back-office\n  - from command line\n  - from a cron job\n\nDocuments can be uploaded with a thumbnail. The default thumbnail of the document type can be used.  \nThe thumbnail can be resized in order to optimize the performance.\n\n## Documentation\n\n### How to declare a document type from config file\n\nCreate a new file `resource_document_types.xml` in the `etc/` folder of your module:\n\n```xml\n\u003cconfig xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:opengento:document:etc/resource_document_types.xsd\"\u003e\n    \u003cdocumentType code=\"cert\"\u003e\n        \u003cscheduledImport\u003etrue\u003c/scheduledImport\u003e\n        \u003cvisibility\u003epublic\u003c/visibility\u003e\n        \u003cname\u003eCertificates\u003c/name\u003e\n        \u003cfileSourcePath\u003ecert/import/\u003c/fileSourcePath\u003e\n        \u003cfileDestPath\u003ecoa/\u003c/fileDestPath\u003e\n        \u003csubPathLength\u003e3\u003c/subPathLength\u003e\n        \u003cfilePattern\u003eCERT-*.[pP][dD][fF]\u003c/filePattern\u003e\n        \u003cfileAllowedExtensions\u003e\n            \u003cextension\u003epdf\u003c/extension\u003e\n        \u003c/fileAllowedExtensions\u003e\n        \u003cdefaultImageFileName\u003edocument/image/cert/thumbnail.png\u003c/defaultImageFileName\u003e\n    \u003c/documentType\u003e\n\u003c/config\u003e\n```\n\n### How to add a new import file processor\n\nWhen files are import from command line or cron jobs, you cannot set manually metadata.  \nThe code, name, and pivot field has to be filled and that is what the file import processor do.  \nIf you need to implement your own logic on how a document should be created on the import fly, check the following code:\n\nImplement the interface `\\Opengento\\Document\\Model\\Document\\ProcessorInterface`:\n\n```php\n\nnamespace Vendor\\Module\\Model\\Document\\Processor;\n\nuse Opengento\\Document\\Api\\Data\\DocumentInterface;\nuse Opengento\\Document\\Api\\Data\\DocumentTypeInterface;\nuse Opengento\\Document\\Model\\Document\\Filesystem\\File;\nuse Opengento\\Document\\Model\\Document\\Filesystem\\Format;\nuse Opengento\\Document\\Model\\Document\\ProcessorInterface;\nuse Opengento\\Document\\Model\\DocumentBuilder;\nuse function basename;\nuse function dirname;\n\nfinal class CustomProcessor implements ProcessorInterface\n{\n    public const CODE = 'custom';\n\n    /**\n     * @var DocumentBuilder\n     */\n    private $documentBuilder;\n\n    /**\n     * @var File\n     */\n    private $fileHelper;\n\n    public function __construct(\n        DocumentBuilder $documentBuilder,\n        File $fileHelper\n    ) {\n        $this-\u003edocumentBuilder = $documentBuilder;\n        $this-\u003efileHelper = $fileHelper;\n    }\n\n    public function execute(DocumentTypeInterface $documentType, string $filePath): DocumentInterface\n    {\n        // $filePath is the path where the source file is currently saved.\n        // You can change the destination path if want to.\n        // Edit the file path value with $this-\u003edocumentBuilder-\u003esetFilePath($newDestPath).\n        // You can also rename the file with $this-\u003edocumentBuilder-\u003esetFileName($newFileName)\n\n        $destFilePath = $this-\u003efileHelper-\u003egetFileDestPath($documentType, $filePath);\n        $fileName = basename($destFilePath);\n\n        $this-\u003edocumentBuilder-\u003esetTypeId($documentType-\u003egetId());\n        $this-\u003edocumentBuilder-\u003esetCode(Format::formatCode($fileName));\n        $this-\u003edocumentBuilder-\u003esetName(Format::formatName($fileName));\n        $this-\u003edocumentBuilder-\u003esetFileName($fileName);\n        $this-\u003edocumentBuilder-\u003esetFilePath(dirname($this-\u003efileHelper-\u003egetRelativeFilePath($destFilePath)));\n\n        return $this-\u003edocumentBuilder-\u003ecreate();\n    }\n}\n```\n\n## Support\n\nRaise a new [request](https://github.com/opengento/magento2-document/issues) to the issue tracker.\n\n## Authors\n\n- **Opengento Community** - *Lead* - [![Twitter Follow](https://img.shields.io/twitter/follow/opengento.svg?style=social)](https://twitter.com/opengento)\n- **Thomas Klein** - *Maintainer* - [![GitHub followers](https://img.shields.io/github/followers/thomas-kl1.svg?style=social)](https://github.com/thomas-kl1)\n- **Contributors** - *Contributor* - [![GitHub contributors](https://img.shields.io/github/contributors/opengento/magento2-document.svg?style=flat-square)](https://github.com/opengento/magento2-document/graphs/contributors)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](./LICENSE) details.\n\n***That's all folks!***\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopengento%2Fmagento2-document","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopengento%2Fmagento2-document","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopengento%2Fmagento2-document/lists"}