{"id":27599755,"url":"https://github.com/blaspsoft/doxswap","last_synced_at":"2025-04-22T15:43:38.412Z","repository":{"id":280594075,"uuid":"942512205","full_name":"Blaspsoft/doxswap","owner":"Blaspsoft","description":"📄 🔄 Doxswap is a Laravel package for seamless document conversion using LibreOffice. Effortlessly convert DOCX, PDF, ODT, and more with a simple, elegant API. Supports Laravel storage, configurable settings, and secure file handling.","archived":false,"fork":false,"pushed_at":"2025-03-26T14:38:54.000Z","size":122,"stargazers_count":200,"open_issues_count":0,"forks_count":15,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-20T05:43:45.903Z","etag":null,"topics":["converter","document-conversion","document-converter","docx","file-conversion","laravel","libreoffice","odt","pdf","php","xlsx"],"latest_commit_sha":null,"homepage":"","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/Blaspsoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-04T08:11:30.000Z","updated_at":"2025-04-19T10:54:15.000Z","dependencies_parsed_at":"2025-03-04T09:25:44.802Z","dependency_job_id":"9e4aecff-a17a-4a74-bd01-4594e6be9ae2","html_url":"https://github.com/Blaspsoft/doxswap","commit_stats":null,"previous_names":["deemonic/doxswap"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blaspsoft%2Fdoxswap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blaspsoft%2Fdoxswap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blaspsoft%2Fdoxswap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blaspsoft%2Fdoxswap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Blaspsoft","download_url":"https://codeload.github.com/Blaspsoft/doxswap/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250270258,"owners_count":21403013,"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":["converter","document-conversion","document-converter","docx","file-conversion","laravel","libreoffice","odt","pdf","php","xlsx"],"created_at":"2025-04-22T15:43:37.497Z","updated_at":"2025-04-22T15:43:38.401Z","avatar_url":"https://github.com/Blaspsoft.png","language":"PHP","readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"./.github/assets/icon.png\" alt=\"Onym Icon\" width=\"150\" height=\"150\"/\u003e\n    \u003cp align=\"center\"\u003e\n        \u003ca href=\"https://github.com/Blaspsoft/doxswap/actions/workflows/main.yml\"\u003e\u003cimg alt=\"GitHub Workflow Status (main)\" src=\"https://github.com/Blaspsoft/doxswap/actions/workflows/main.yml/badge.svg\"\u003e\u003c/a\u003e\n        \u003ca href=\"https://packagist.org/packages/blaspsoft/doxswap\"\u003e\u003cimg alt=\"Total Downloads\" src=\"https://img.shields.io/packagist/dt/blaspsoft/doxswap\"\u003e\u003c/a\u003e\n        \u003ca href=\"https://packagist.org/packages/blaspsoft/doxswap\"\u003e\u003cimg alt=\"Latest Version\" src=\"https://img.shields.io/packagist/v/blaspsoft/doxswap\"\u003e\u003c/a\u003e\n        \u003ca href=\"https://packagist.org/packages/blaspsoft/doxswap\"\u003e\u003cimg alt=\"License\" src=\"https://img.shields.io/packagist/l/blaspsoft/doxswap\"\u003e\u003c/a\u003e\n    \u003c/p\u003e\n\u003c/p\u003e\n\n# Doxswap\n\nA Laravel package for seamless document and image format conversions. Transform between various formats like DOCX -\u003e PDF, HTML -\u003e PDF, PNG -\u003e WEBP, and more popular formats using a simple, elegant API. Powered by LibreOffice for documents and ImageMagick for image processing.\n\n## 🚀 Features\n\n- 📄 **Multiple Format Support** – Convert between documents (DOCX, XLSX, ODT) and images (PNG, JPG, WEBP) with ease\n- 🚀 **Simple API** – Easy-to-use interface for all conversion operations\n- 💾 **Laravel Storage Integration** – Works seamlessly with Laravel's filesystem drivers\n- ⚡ **Efficient Processing** – Optimized conversion using LibreOffice and ImageMagick engines\n- 🔍 **Conversion Tracking** – Detailed results including duration and file paths\n- 🔒 **Secure File Handling** – Safe and secure file processing with proper cleanup\n- ⚙️ **Configurable Settings** – Customize paths, storage disks, and conversion options\n- 🛡️ **Error Handling** – Robust exception handling for unsupported formats and conversions\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require blaspsoft/doxswap\n```\n\nYou can publish the config file with:\n\n```bash\nphp artisan vendor:publish --tag=\"doxswap-config\"\n```\n\n### Overview\n\nThe `config/doxswap.php` file includes:\n\n#### 💾 Storage \u0026 Cleanup\n\n- `input_disk`: Where to read files from (default: 'public')\n- `output_disk`: Where to save converted files (default: 'public')\n- `perform_cleanup`: Delete input files after conversion (default: false)\n\n#### 📝 File Naming\n\nConfigure how output files are named using different strategies:\n\n```php\n'filename' =\u003e [\n    // Strategy: 'original', 'random', or 'timestamp'\n    'strategy' =\u003e 'original',\n\n    // Naming options\n    'options' =\u003e [\n        'length' =\u003e 24,          // Length for random names\n        'prefix' =\u003e '',          // Add prefix to filename\n        'suffix' =\u003e '',          // Add suffix to filename\n        'separator' =\u003e '_',      // Separator for components\n        'format' =\u003e 'YmdHis',    // Format for timestamp strategy\n    ],\n]\n```\n\n#### 🛠️ Conversion Drivers\n\nConfigure paths for conversion tools:\n\n```php\n'drivers' =\u003e [\n    'libreoffice_path' =\u003e env('LIBRE_OFFICE_PATH', '/usr/bin/soffice'),\n]\n```\n\nDefault LibreOffice paths by OS:\n\n- 🐧 Linux: `/usr/bin/soffice`\n- 🍎 macOS: `/Applications/LibreOffice.app/Contents/MacOS/soffice`\n- 🪟 Windows: `C:\\Program Files\\LibreOffice\\program\\soffice.exe`\n\n#### 📄 File Types\n\nSupports various document formats including:\n\n- Documents: DOC, DOCX, ODT, RTF, TXT\n- Spreadsheets: XLS, XLSX, ODS, CSV\n- Presentations: PPT, PPTX, ODP\n- Images: JPG, PNG, SVG, BMP, TIFF, WEBP, GIF\n- Web: HTML, XML\n- Other: PDF\n\n### Usage\n\n```php\n$result = Doxswap::convert('sample.docx', 'pdf');\n\n/**\n * Returns a ConversionResult object with the following properties:\n *\n * @property string $inputFilename   The original input filename\n * @property string $inputFilePath   The full path to the input file\n * @property string $outputFilename  The converted output filename\n * @property string $outputFilePath  The full path to the converted output file\n * @property string $toFormat       The format the file was converted to (e.g. 'pdf')\n * @property string $duration       The time taken for conversion (e.g. \"2.21 sec\")\n * @property float  $startTime      Unix timestamp of when conversion started\n * @property float  $endTime        Unix timestamp of when conversion completed\n * @property string $inputDisk      The Laravel storage disk used for input\n * @property string $outputDisk     The Laravel storage disk used for output\n */\n\n```\n\n## Requirements\n\n### LibreOffice \u0026 ImageMagick\n\nThis package requires LibreOffice, ImageMagick, and Potrace to be installed on your system. Here's how to install them:\n\n#### Ubuntu/Debian\n\n```bash\nsudo apt update\nsudo apt install libreoffice imagemagick potrace\n```\n\n#### macOS\n\n```bash\nbrew install libreoffice imagemagick potrace\n```\n\n#### Windows\n\n```bash\nchoco install libreoffice imagemagick potrace\n```\n\n#### Docker\n\nIf you're using Docker, you can add the required dependencies to your container:\n\n```dockerfile\n# Ubuntu/Debian based\nRUN apt-get update \u0026\u0026 apt-get install -y libreoffice imagemagick potrace\n\n# Alpine based\nRUN apk add --no-cache libreoffice imagemagick potrace\n```\n\n### PHP Requirements\n\n- PHP \u003e= 8.1\n- ext-fileinfo\n- ext-imagick\n- Laravel \u003e= 9.0\n\n## 🔁 Supported Conversions by Category\n\n### 📝 Documents\n\n| From | Supported Conversions                          |\n| ---- | ---------------------------------------------- |\n| DOCX | PDF ✅✅, ODT, RTF, TXT, HTML, XML, EPUB       |\n| DOC  | PDF ✅✅, DOCX, ODT, RTF, TXT, HTML, XML, EPUB |\n| ODT  | PDF, DOCX, RTF, TXT, HTML, XML                 |\n| RTF  | PDF, DOCX, ODT, TXT, HTML, XML                 |\n| TXT  | PDF, DOCX, ODT, HTML, XML                      |\n| HTML | PDF, ODT, TXT                                  |\n| XML  | PDF, DOCX, ODT, TXT, HTML                      |\n\n### 📊 Spreadsheets\n\n| From | Supported Conversions |\n| ---- | --------------------- |\n| XLSX | PDF ✅✅, ODS, CSV    |\n| XLS  | PDF, XLSX, ODS, CSV   |\n| ODS  | PDF, XLSX, CSV        |\n| CSV  | PDF, XLSX, ODS        |\n\n### 🎯 Presentations\n\n| From | Supported Conversions |\n| ---- | --------------------- |\n| PPTX | PDF ✅✅, ODP         |\n| PPT  | PDF, PPTX, ODP        |\n| ODP  | PDF, PPTX             |\n\n### 🖼️ Images\n\n| From | Supported Conversions                  |\n| ---- | -------------------------------------- |\n| PNG  | PDF ✅, JPG, SVG, TIFF, WEBP, GIF, BMP |\n| JPG  | PDF ✅, PNG, SVG, TIFF, WEBP, GIF, BMP |\n| SVG  | PDF, PNG, JPG, TIFF, WEBP, GIF, BMP    |\n| BMP  | PDF, PNG, JPG, SVG, TIFF, WEBP, GIF    |\n| TIFF | PDF, PNG, JPG, SVG, WEBP, GIF, BMP     |\n| WEBP | PDF, PNG, JPG, SVG, TIFF, GIF, BMP     |\n| GIF  | PDF, PNG, JPG, SVG, TIFF, WEBP, BMP    |\n\n### Legend 🔍\n\n- ✅✅ = Common high-priority conversion\n- ✅ = Popular supported format\n- (unlisted) = Conversion not supported\n\n\u003e **Note**: Document conversions are performed using LibreOffice in headless mode, while image format conversions utilize ImageMagick 🚀\n\n## 🤝 Sponsors\n\nIf you find this package helpful, please consider sponsoring the development:\n\n\u003e 🚀 [Become a GitHub Sponsor](https://github.com/sponsors/Blaspsoft)\n\n## License\n\nBlasp is open-sourced software licensed under the [MIT license](LICENSE).\n","funding_links":["https://github.com/sponsors/Blaspsoft"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblaspsoft%2Fdoxswap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblaspsoft%2Fdoxswap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblaspsoft%2Fdoxswap/lists"}