shipfastlabs/parsel

A fast, helpful, and open-source document parser for PHP

What it solves

Parsel provides a unified PHP API for parsing documents into formats like Markdown, plain text, and structured data. It eliminates the need to write separate integrations for different document parsing tools by providing a single, expressive interface that works across multiple interchangeable drivers.

How it works

Parsel acts as a wrapper around various document parsing engines (drivers). It supports local drivers like LiteParse and AnyDoc, which can be installed via a dedicated installer. Users can switch between drivers or set a process-wide default to handle different file types (e.g., PDF, DOCX, EPUB, CSV) and output formats. It also allows for custom driver implementation via a Driver contract, enabling integration with remote APIs or other tools.

Who it’s for

PHP developers who need to integrate document parsing and OCR capabilities into their applications without being tied to a specific parsing tool or provider.

Highlights

  • Interchangeable Drivers: Supports LiteParse and AnyDoc out of the box, with an extensible architecture for custom drivers.
  • Flexible Output: Converts documents to Markdown, plain text, JSON, or structured pages with coordinates.
  • Advanced Parsing Options: Includes support for OCR, DPI settings, page range selection, and screenshot generation from documents.
  • Detailed Control: Provides typed options for specific drivers (e.g., LiteParseOptions) to manage fine-grained behavior like image embedding and header/footer preservation.
  • Lazy Loading: Supports streaming large documents via lazyPages() to avoid memory overhead.
  • Testing Utilities: Includes a Parsel::fake() method to mock parsing responses for testing purposes.

Related

  • Project
  • Project
  • Project
  • Project
  • Project