Download the PHP package italix/converters without Composer

On this page you can find all versions of the php package italix/converters. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package converters

italix/converters

PHP Version

A pairwise format-conversion contract, and a driver registry that routes between formats no single driver connects directly.

Status: the contract, the router, and two real consumers. italix/documents (Markdown → HTML → PDF) and italix/media (raster image conversion, PDF-page-to-image) both build their ConverterSet on this library and register real drivers into it — including, together, a proven cross-library route: md → html → pdf → png. 34 assertions here in tests/ConverterSetTest.php, still all against a fake in-memory driver, because the routing logic itself needs no external binary to verify — the real drivers are tested where they live.

The idea

Converting one document format into another is almost always someone else's problem solved by a binary you shell out to — Pandoc, LibreOffice headless, ffmpeg. What is not someone else's problem is: which binary handles which pair, what happens when the pair you need isn't handled by any one binary directly, and what happens when that binary isn't installed. That's what this library is — the plumbing, not the drivers.

A Converter is one driver's honest description of itself: the exact (from, to) extension pairs it can convert directly, and whether it's actually usable right now. A ConverterSet is a collection of those, and it does the one thing no single driver can: find a route when nothing converts .docx to .mp4 directly, by chaining .docx → .pdf → .png → .mp4 through three different drivers that have never heard of each other.

This is deliberately its own library rather than living inside italix/documents or a future italix/media. Both of those are real, wanted consumers — one drives document formats (odt/docx/pdf/markdown), the other would drive image/audio/video/3D formats — and neither owns the concept of "convert format A to format B by any means necessary." Putting the contract in either one would make the other's dependency direction backwards.

Installation

Requires PHP 8.1+. No other dependency — a driver is free to require whatever it needs (an extension, a binary on $PATH), but that requirement belongs to the driver, not to this library.

The contract

pairs() is the single source of truth ConverterSet routes against — there's no separate handles($from, $to) that could fall out of sync with it. is_available() exists so a driver that shells out can report "not installed" instead of throwing from its constructor: absence of a binary is a normal, expected state for a driver to be in, not an exceptional one.

Options

convert() always receives a ConversionOptions — never null, so a driver never has to null-check. The common case is ConversionOptions::none(), and ConverterSet::convert() supplies it automatically when a caller doesn't pass one:

A handful of keys recur across drivers that otherwise share nothing — a JPEG encoder and a WebP encoder both have a "quality"; a paginated source and a paginated target both have a "page" — those get a named constant (QUALITY, LOSSLESS, PAGE, WIDTH, HEIGHT, COLORSPACE, ICC_PROFILE) and a typed with_*()/*_n() pair, so two drivers agree on the same spelling instead of inventing their own. Everything else is a plain with(string $key, mixed $value) — a driver-specific knob never requires a change to this class.

The same ConversionOptions instance reaches every hop of a routed, multi-step conversion unchanged — there's no per-hop options map. A three-hop route where only the first hop understands PAGE and only the last understands QUALITY works correctly with one shared bag: each driver reads the keys it recognizes and ignores the rest.

An unrecognized key is silently ignored; a recognized-but-impossible one throws. Asking a driver for an option it's never heard of is expected — it's probably meant for a different hop on the same route. Asking for colorspace=cmyk from a driver that can only ever produce RGB is different: it throws UnsupportedOptionException rather than silently returning RGB anyway, because a PDF a print vendor expects in CMYK and receives in RGB is a correctness bug wearing a passing test, not a cosmetic shortfall. Neither italix/documents nor italix/media can produce real CMYK today — ext-gd has no CMYK support at all, and dompdf's PDF output is RGB-only — so COLORSPACE and ICC_PROFILE are declared here without a driver yet able to honor them: the vocabulary exists so a future Imagick-backed driver, built against a real embedded ICC profile (naive RGB→CMYK math produces wrong print colors, which is the entire reason ICC profiles exist), has a name to read from.

Routing

Three things worth knowing about how routing decides:

Cooperating with other libraries

Neither italix/documents nor a future italix/media needs to know the other exists. Each builds its own ConverterSet, registering only the drivers relevant to its own domain — Documents' Markdown-to-HTML, LibreOffice-backed office formats; Media's ffmpeg/ImageMagick-backed image, audio and video formats. Cross-domain conversions (a Markdown file rendered to speech, the first page of a PDF exported as an image) only require whoever is wiring the application together to register both libraries' driver sets into one shared ConverterSet — routing across the boundary then falls out of the same shortest-path search, with neither library ever importing the other.

Verification

34 assertions in tests/ConverterSetTest.php, run with:

All against a FakeConverter/OptionsAwareFakeConverter test double rather than a real driver — the routing logic (shortest path, availability filtering, first-registered-wins tie-breaking, byte threading across hops, ConversionOptions reaching every hop unchanged) is what this library actually owns, and it needs no external binary to verify. Every branch was mutation-tested by hand while writing this suite, and one of those mutations (breadth-first search weakened to a stack-ordered traversal) exposed that the first version of the "shortest path wins" test was too weak to tell BFS apart from a bug — it happened to find a direct edge on the very first expansion regardless of traversal order. The test that replaced it is deliberately adversarial: a 2-hop route registered first, next to a 3-hop detour that a naive "explore what you just pushed" search would return instead.

What isn't covered here, by construction: real drivers, real external binaries, and cross-library routing. That's italix/documents' and italix/media's own test suites — in particular italix/media's tests/PdfPageToImageConverterTest.php, which proves the full md → html → pdf → png chain across both libraries against real dompdf and Ghostscript calls.

License

Mozilla Public License 2.0 — see LICENSE.


All versions of converters with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package italix/converters contains the following files

Loading the files please wait ...