1. Go to this page and download the library: Download hosmelq/laravel-anydoc 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/ */
hosmelq / laravel-anydoc example snippets
use HosmelQ\Anydoc\Laravel\Facades\Anydoc;
$markdown = Anydoc::file('report.docx')->markdown();
use HosmelQ\Anydoc\Laravel\Contracts\Anydoc;
final class ConvertDocument
{
public function __construct(private Anydoc $anydoc) {}
public function handle(string $path): string
{
return $this->anydoc->file($path)->markdown();
}
}
use Anydoc\Exception\ConvertException;
use Anydoc\Exception\PanicException;
use HosmelQ\Anydoc\Laravel\Facades\Anydoc;
try {
$markdown = Anydoc::file('report.docx')->markdown();
} catch (ConvertException $exception) {
report($exception);
} catch (PanicException $exception) {
report($exception);
}