1. Go to this page and download the library: Download italix/converters library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
italix / converters example snippets
use Italix\Converters\ConverterSet;
$set = new ConverterSet([$markdown_to_html, $html_to_pdf, $text_to_mp3, /* … */]);
$set->convert($bytes, 'md', 'pdf'); // one driver per hop, chained automatically
$set->convert($bytes, 'md', 'mp3'); // md -> html -> text -> mp3, if that's what's registered
interface Converter
{
/** @return array<array{0: string, 1: string}> every (from, to) pair this driver handles directly */
public function pairs(): array;
/** Is whatever this driver depends on (a binary, an extension) usable right now? */
public function is_available(): bool;
public function convert(
string $source,
string $from_extension_c,
string $to_extension_c,
ConversionOptions $options
): ConvertedDocument;
/** One line, for a CLI probe. */
public function describe(): string;
}
use Italix\Converters\ConversionOptions;
$set->convert($bytes, 'png', 'webp'); // no options — the common case
$set->convert($bytes, 'png', 'webp', ConversionOptions::none()->with_quality(95));
$set->convert($bytes, 'pdf', 'png', ConversionOptions::none()->with_page(2));
use Italix\Converters\ConverterSet;
use Italix\Converters\NoRouteException;
$set = new ConverterSet([$md_to_html, $html_to_pdf]);
$set->route('md', 'pdf'); // [[md, html, $md_to_html], [html, pdf, $html_to_pdf]]
$set->convert($bytes, 'md', 'pdf'); // walks that route, feeding each hop's output into the next
try {
$set->convert($bytes, 'md', 'mp4');
} catch (NoRouteException $e) {
// "No route from .md to .mp4. Reachable from .md: .html, .pdf."
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.