PHPackages                             blaspsoft/doxswap - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. blaspsoft/doxswap

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

blaspsoft/doxswap
=================

Doxswap is a simple document conversion package for Laravel which uses LibreOffice to convert documents to a variety of formats.

v1.0.2(7mo ago)23812.3k—6.4%20[4 issues](https://github.com/Blaspsoft/doxswap/issues)1MITPHPPHP ^8.2CI passing

Since Mar 5Pushed 7mo ago5 watchersCompare

[ Source](https://github.com/Blaspsoft/doxswap)[ Packagist](https://packagist.org/packages/blaspsoft/doxswap)[ Docs](https://github.com/blaspsoft/doxswap)[ GitHub Sponsors](https://github.com/Blaspsoft)[ RSS](/packages/blaspsoft-doxswap/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (4)Versions (3)Used By (1)

 [![Onym Icon](./.github/assets/icon.png)](./.github/assets/icon.png)

 [![GitHub Workflow Status (main)](https://github.com/Blaspsoft/doxswap/actions/workflows/main.yml/badge.svg)](https://github.com/Blaspsoft/doxswap/actions/workflows/main.yml) [![Total Downloads](https://camo.githubusercontent.com/df30b666e43f791f3749892fcca6b36a4f85cfda99bbceb29458bec506dcea88/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f626c617370736f66742f646f7873776170)](https://packagist.org/packages/blaspsoft/doxswap) [![Latest Version](https://camo.githubusercontent.com/ad85384bb189494ac7b1a15366cd8203f5d0ae854ffb6b9c4e256ac2a0eecf3c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626c617370736f66742f646f7873776170)](https://packagist.org/packages/blaspsoft/doxswap) [![License](https://camo.githubusercontent.com/35809d16f04dc609ac6387a6d3b6a8faee85d0643f5751132a5dbedcffbfa1e6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f626c617370736f66742f646f7873776170)](https://packagist.org/packages/blaspsoft/doxswap)

Doxswap
=======

[](#doxswap)

A Laravel package for seamless document and image format conversions. Transform between various formats like DOCX -&gt; PDF, HTML -&gt; PDF, PNG -&gt; WEBP, and more popular formats using a simple, elegant API. Powered by LibreOffice for documents and ImageMagick for image processing.

🚀 Features
----------

[](#-features)

- 📄 **Multiple Format Support** – Convert between documents (DOCX, XLSX, ODT) and images (PNG, JPG, WEBP) with ease
- 🚀 **Simple API** – Easy-to-use interface for all conversion operations
- 💾 **Laravel Storage Integration** – Works seamlessly with Laravel's filesystem drivers
- ⚡ **Efficient Processing** – Optimized conversion using LibreOffice and ImageMagick engines
- 🔍 **Conversion Tracking** – Detailed results including duration and file paths
- 🔒 **Secure File Handling** – Safe and secure file processing with proper cleanup
- ⚙️ **Configurable Settings** – Customize paths, storage disks, and conversion options
- 🛡️ **Error Handling** – Robust exception handling for unsupported formats and conversions

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require blaspsoft/doxswap
```

You can publish the config file with:

```
php artisan vendor:publish --tag="doxswap-config"
```

### Overview

[](#overview)

The `config/doxswap.php` file includes:

#### 💾 Storage &amp; Cleanup

[](#-storage--cleanup)

- `input_disk`: Where to read files from (default: 'public')
- `output_disk`: Where to save converted files (default: 'public')
- `perform_cleanup`: Delete input files after conversion (default: false)

#### 📝 File Naming

[](#-file-naming)

Configure how output files are named using different strategies:

```
'filename' => [
    // Strategy: 'original', 'random', or 'timestamp'
    'strategy' => 'original',

    // Naming options
    'options' => [
        'length' => 24,          // Length for random names
        'prefix' => '',          // Add prefix to filename
        'suffix' => '',          // Add suffix to filename
        'separator' => '_',      // Separator for components
        'format' => 'YmdHis',    // Format for timestamp strategy
    ],
]
```

#### 🛠️ Conversion Drivers

[](#️-conversion-drivers)

Configure paths for conversion tools:

```
'drivers' => [
    'libreoffice_path' => env('LIBRE_OFFICE_PATH', '/usr/bin/soffice'),
]
```

Default LibreOffice paths by OS:

- 🐧 Linux: `/usr/bin/soffice`
- 🍎 macOS: `/Applications/LibreOffice.app/Contents/MacOS/soffice`
- 🪟 Windows: `C:\Program Files\LibreOffice\program\soffice.exe`

#### 📄 File Types

[](#-file-types)

Supports various document formats including:

- Documents: DOC, DOCX, ODT, RTF, TXT
- Spreadsheets: XLS, XLSX, ODS, CSV
- Presentations: PPT, PPTX, ODP
- Images: JPG, PNG, SVG, BMP, TIFF, WEBP, GIF
- Web: HTML, XML
- Other: PDF

### Usage

[](#usage)

```
$result = Doxswap::convert('sample.docx', 'pdf');

/**
 * Returns a ConversionResult object with the following properties:
 *
 * @property string $inputFilename   The original input filename
 * @property string $inputFilePath   The full path to the input file
 * @property string $outputFilename  The converted output filename
 * @property string $outputFilePath  The full path to the converted output file
 * @property string $toFormat       The format the file was converted to (e.g. 'pdf')
 * @property string $duration       The time taken for conversion (e.g. "2.21 sec")
 * @property float  $startTime      Unix timestamp of when conversion started
 * @property float  $endTime        Unix timestamp of when conversion completed
 * @property string $inputDisk      The Laravel storage disk used for input
 * @property string $outputDisk     The Laravel storage disk used for output
 */
```

Requirements
------------

[](#requirements)

### LibreOffice &amp; ImageMagick

[](#libreoffice--imagemagick)

This package requires LibreOffice, ImageMagick, and Potrace to be installed on your system. Here's how to install them:

#### Ubuntu/Debian

[](#ubuntudebian)

```
sudo apt update
sudo apt install libreoffice imagemagick potrace
```

#### macOS

[](#macos)

```
brew install libreoffice imagemagick potrace
```

#### Windows

[](#windows)

```
choco install libreoffice imagemagick potrace
```

#### Docker

[](#docker)

If you're using Docker, you can add the required dependencies to your container:

```
# Ubuntu/Debian based
RUN apt-get update && apt-get install -y libreoffice imagemagick potrace

# Alpine based
RUN apk add --no-cache libreoffice imagemagick potrace
```

### PHP Requirements

[](#php-requirements)

- PHP &gt;= 8.1
- ext-fileinfo
- ext-imagick
- Laravel &gt;= 9.0

🔁 Supported Conversions by Category
-----------------------------------

[](#-supported-conversions-by-category)

### 📝 Documents

[](#-documents)

FromSupported ConversionsDOCXPDF ✅✅, ODT, RTF, TXT, HTML, XML, EPUBDOCPDF ✅✅, DOCX, ODT, RTF, TXT, HTML, XML, EPUBODTPDF, DOCX, RTF, TXT, HTML, XMLRTFPDF, DOCX, ODT, TXT, HTML, XMLTXTPDF, DOCX, ODT, HTML, XMLHTMLPDF, ODT, TXTXMLPDF, DOCX, ODT, TXT, HTML### 📊 Spreadsheets

[](#-spreadsheets)

FromSupported ConversionsXLSXPDF ✅✅, ODS, CSVXLSPDF, XLSX, ODS, CSVODSPDF, XLSX, CSVCSVPDF, XLSX, ODS### 🎯 Presentations

[](#-presentations)

FromSupported ConversionsPPTXPDF ✅✅, ODPPPTPDF, PPTX, ODPODPPDF, PPTX### 🖼️ Images

[](#️-images)

FromSupported ConversionsPNGPDF ✅, JPG, SVG, TIFF, WEBP, GIF, BMPJPGPDF ✅, PNG, SVG, TIFF, WEBP, GIF, BMPSVGPDF, PNG, JPG, TIFF, WEBP, GIF, BMPBMPPDF, PNG, JPG, SVG, TIFF, WEBP, GIFTIFFPDF, PNG, JPG, SVG, WEBP, GIF, BMPWEBPPDF, PNG, JPG, SVG, TIFF, GIF, BMPGIFPDF, PNG, JPG, SVG, TIFF, WEBP, BMP### Legend 🔍

[](#legend-)

- ✅✅ = Common high-priority conversion
- ✅ = Popular supported format
- (unlisted) = Conversion not supported

> **Note**: Document conversions are performed using LibreOffice in headless mode, while image format conversions utilize ImageMagick 🚀

🤝 Sponsors
----------

[](#-sponsors)

If you find this package helpful, please consider sponsoring the development:

> 🚀 [Become a GitHub Sponsor](https://github.com/sponsors/Blaspsoft)

License
-------

[](#license)

Blasp is open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance63

Regular maintenance activity

Popularity46

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~213 days

Total

2

Last Release

226d ago

Major Versions

0.1.0-beta → v1.0.22025-10-05

### Community

Maintainers

![](https://www.gravatar.com/avatar/c728f738aa352593e59935f2b03a4bcafb2c721535f28684909a3b183c8467b7?d=identicon)[Deemonic](/maintainers/Deemonic)

---

Top Contributors

[![deemonic](https://avatars.githubusercontent.com/u/25927364?v=4)](https://github.com/deemonic "deemonic (17 commits)")[![smiliyas](https://avatars.githubusercontent.com/u/13122679?v=4)](https://github.com/smiliyas "smiliyas (1 commits)")

---

Tags

converterdocument-conversiondocument-converterdocxfile-conversionlaravellibreofficeodtpdfphpxlsxblaspsoftdoxswap

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/blaspsoft-doxswap/health.svg)

```
[![Health](https://phpackages.com/badges/blaspsoft-doxswap/health.svg)](https://phpackages.com/packages/blaspsoft-doxswap)
```

###  Alternatives

[maatwebsite/excel

Supercharged Excel exports and imports in Laravel

12.7k144.3M712](/packages/maatwebsite-excel)[barryvdh/laravel-dompdf

A DOMPDF Wrapper for Laravel

7.3k87.6M278](/packages/barryvdh-laravel-dompdf)[barryvdh/laravel-snappy

Snappy PDF/Image for Laravel

2.8k24.8M48](/packages/barryvdh-laravel-snappy)[rap2hpoutre/fast-excel

Fast Excel import/export for Laravel

2.3k24.9M47](/packages/rap2hpoutre-fast-excel)[elibyy/tcpdf-laravel

tcpdf support for Laravel 6, 7, 8, 9, 10, 11

3542.7M5](/packages/elibyy-tcpdf-laravel)[blaspsoft/blasp

Blasp is a powerful and customisable profanity filter package for Laravel applications

329174.3k1](/packages/blaspsoft-blasp)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
